3 #include "RelationalAccess/AuthenticationCredentials.h"
4 #include "RelationalAccess/AuthenticationServiceException.h"
8 #include "RelationalAccess/AuthenticationServiceException.h"
9 #include "CoralKernel/IPropertyManager.h"
10 #include "CoralKernel/Property.h"
11 #include "CoralKernel/Context.h"
19 #include "CoralBase/MessageStream.h"
23 : coral::
Service(key), m_authenticationPath(
""), m_db(), m_cache(), m_callbackID(0) {
24 boost::function1<void, std::string> cb(
27 std::placeholders::_1));
29 coral::Property* pm =
dynamic_cast<coral::Property*
>(
45 const coral::IAuthenticationCredentials&
49 const coral::IAuthenticationCredentials* creds = m_cache.get(connectionString);
51 std::string credsStoreConn = m_db.setUpForConnectionString(connectionString, m_authenticationPath);
52 coral::MessageStream
log(
"cond::RelationalAuthenticationService::credentials");
53 log <<
coral::Debug <<
"Connecting to the credential repository in \"" << credsStoreConn <<
"\" with principal \""
54 << m_db.keyPrincipalName() <<
"\"." << coral::MessageStream::endmsg;
55 m_db.selectForUser(m_cache);
57 creds = m_cache.get(connectionString);
60 msg += connectionString +
"\"";
61 msg +=
" with role \"COND_DEFAULT_ROLE\" is not available for ";
62 msg += m_db.keyPrincipalName();
63 cond::throwException(msg,
"cond::RelationalAuthenticationService::RelationalAuthenticationService::credentials");
68 const coral::IAuthenticationCredentials&
72 const coral::IAuthenticationCredentials* creds = m_cache.get(connectionString, role);
74 std::string credsStoreConn = m_db.setUpForConnectionString(connectionString, m_authenticationPath);
75 coral::MessageStream
log(
"cond::RelationalAuthenticationService::credentials");
76 log <<
coral::Debug <<
"Connecting to the credential repository in \"" << credsStoreConn <<
"\" with principal \""
77 << m_db.keyPrincipalName() <<
"\"." << coral::MessageStream::endmsg;
78 m_db.selectForUser(m_cache);
80 creds = m_cache.get(connectionString, role);
83 msg += connectionString +
"\"";
84 msg +=
" with role \"" + role +
"\" is not available for ";
85 msg += m_db.keyPrincipalName();
86 cond::throwException(msg,
"cond::RelationalAuthenticationService::RelationalAuthenticationService::credentials");
92 return m_db.keyPrincipalName();
96 "COND/Services/RelationalAuthenticationService");
static std::vector< std::string > checklist log
const coral::IAuthenticationCredentials & credentials(const std::string &connectionString) const override
coral::Property::CallbackID m_callbackID
static PFTauRenderPlugin instance
std::string to_lower(const std::string &s)
static constexpr const char *const COND_AUTH_PATH_PROPERTY
void throwException(const std::string &message, const std::string &methodName)
#define DEFINE_CORALSERVICE(type, name)
void setAuthenticationPath(const std::string &inputPath)
Sets the input file name.
std::string principalName() override
tuple key
prepare the HTCondor submission files and eventually submit them
~RelationalAuthenticationService() override
Standard Destructor.
RelationalAuthenticationService(const std::string &name)
Standard Constructor.