#include <RelationalAuthenticationService.h>
Public Member Functions | |
const coral::IAuthenticationCredentials & | credentials (const std::string &connectionString) const |
const coral::IAuthenticationCredentials & | credentials (const std::string &connectionString, const std::string &role) const |
RelationalAuthenticationService (const std::string &name) | |
Standard Constructor. | |
void | setAuthenticationPath (const std::string &inputPath) |
Sets the input file name. | |
virtual | ~RelationalAuthenticationService () |
Standard Destructor. | |
Private Attributes | |
std::string | m_authenticationPath |
The input file with the data. | |
coral_bridge::AuthenticationCredentialSet | m_cache |
coral::Property::CallbackID | m_callbackID |
CredentialStore | m_db |
The service providing the authentication data. |
Definition at line 26 of file RelationalAuthenticationService.h.
cond::RelationalAuthenticationService::RelationalAuthenticationService::RelationalAuthenticationService | ( | const std::string & | name | ) | [explicit] |
Standard Constructor.
Definition at line 24 of file RelationalAuthenticationService.cc.
References cond::Auth::COND_AUTH_PATH_PROPERTY, instance, m_callbackID, and setAuthenticationPath().
: coral::Service( key ), m_authenticationPath(""), m_db(), m_cache(), m_callbackID(0) { boost::function1<void, std::string> cb(boost::bind(&cond::RelationalAuthenticationService::RelationalAuthenticationService::setAuthenticationPath, this, _1)); coral::Property* pm = dynamic_cast<coral::Property*>(coral::Context::instance().PropertyManager().property(Auth::COND_AUTH_PATH_PROPERTY)); if(pm){ setAuthenticationPath( pm->get() ); m_callbackID = pm->registerCallback(cb); } }
cond::RelationalAuthenticationService::RelationalAuthenticationService::~RelationalAuthenticationService | ( | ) | [virtual] |
const coral::IAuthenticationCredentials & cond::RelationalAuthenticationService::RelationalAuthenticationService::credentials | ( | const std::string & | connectionString | ) | const |
Returns a reference to the credentials object for a given connection string. If the connection string is not known to the service an UnknownConnectionException is thrown.
Definition at line 52 of file RelationalAuthenticationService.cc.
References Debug, edm::endmsg(), funct::log(), lumiQueryAPI::msg, and AlCaHLTBitMon_QueryRunRegistry::string.
{ const coral::IAuthenticationCredentials* creds = m_cache.get( connectionString ); if( !creds ){ std::string credsStoreConn = m_db.setUpForConnectionString( connectionString, m_authenticationPath ); coral::MessageStream log("cond::RelationalAuthenticationService::credentials"); log << coral::Debug << "Connecting to the credential repository in \"" << credsStoreConn << "\" with principal \""<<m_db.keyPrincipalName()<<"\"."<<coral::MessageStream::endmsg; m_db.selectForUser( m_cache ); } creds = m_cache.get( connectionString ); if( ! creds ){ std::string msg("No Authentication available for connection=\""); msg += connectionString + "\"."; throw coral::AuthenticationServiceException( msg, "cond::RelationalAuthenticationService::RelationalAuthenticationService::credentials", ""); } return *creds; }
const coral::IAuthenticationCredentials & cond::RelationalAuthenticationService::RelationalAuthenticationService::credentials | ( | const std::string & | connectionString, |
const std::string & | role | ||
) | const |
Returns a reference to the credentials object for a given connection string. If the connection string is not known to the service an UnknownConnectionException is thrown. If the role is not known to the service an UnknownRoleException is thrown.
Definition at line 71 of file RelationalAuthenticationService.cc.
References Debug, edm::endmsg(), funct::log(), lumiQueryAPI::msg, and AlCaHLTBitMon_QueryRunRegistry::string.
{ const coral::IAuthenticationCredentials* creds = m_cache.get( connectionString, role ); if( !creds ){ std::string credsStoreConn = m_db.setUpForConnectionString( connectionString, m_authenticationPath ); coral::MessageStream log("cond::RelationalAuthenticationService::credentials"); log << coral::Debug << "Connecting to the credential repository in \"" << credsStoreConn << "\" with principal \""<<m_db.keyPrincipalName()<<"\"."<<coral::MessageStream::endmsg; m_db.selectForUser( m_cache ); } creds = m_cache.get( connectionString, role ); if( ! creds ){ std::string msg("No Authentication available for connection=\""); msg += connectionString + "\"."; msg += " and role=\"" + role + "\"."; throw coral::AuthenticationServiceException( msg, "cond::RelationalAuthenticationService::RelationalAuthenticationService::credentials",""); } return *creds; }
void cond::RelationalAuthenticationService::RelationalAuthenticationService::setAuthenticationPath | ( | const std::string & | inputPath | ) |
Sets the input file name.
Definition at line 45 of file RelationalAuthenticationService.cc.
Referenced by RelationalAuthenticationService().
{ m_authenticationPath = inputPath; m_cache.reset(); }
std::string cond::RelationalAuthenticationService::RelationalAuthenticationService::m_authenticationPath [private] |
The input file with the data.
Definition at line 59 of file RelationalAuthenticationService.h.
coral_bridge::AuthenticationCredentialSet cond::RelationalAuthenticationService::RelationalAuthenticationService::m_cache [mutable, private] |
Definition at line 64 of file RelationalAuthenticationService.h.
coral::Property::CallbackID cond::RelationalAuthenticationService::RelationalAuthenticationService::m_callbackID [private] |
Definition at line 66 of file RelationalAuthenticationService.h.
Referenced by RelationalAuthenticationService().
CredentialStore cond::RelationalAuthenticationService::RelationalAuthenticationService::m_db [mutable, private] |
The service providing the authentication data.
Definition at line 62 of file RelationalAuthenticationService.h.