CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
cond::RelationalAuthenticationService::RelationalAuthenticationService Class Reference

#include <RelationalAuthenticationService.h>

Inheritance diagram for cond::RelationalAuthenticationService::RelationalAuthenticationService:

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. More...
 
void setAuthenticationPath (const std::string &inputPath)
 Sets the input file name. More...
 
virtual ~RelationalAuthenticationService ()
 Standard Destructor. More...
 

Private Attributes

std::string m_authenticationPath
 The input file with the data. More...
 
coral_bridge::AuthenticationCredentialSet m_cache
 
coral::Property::CallbackID m_callbackID
 
CredentialStore m_db
 The service providing the authentication data. More...
 

Detailed Description

Definition at line 26 of file RelationalAuthenticationService.h.

Constructor & Destructor Documentation

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().

25  : coral::Service( key ),
27  m_db(),
28  m_cache(),
29  m_callbackID(0)
30 {
31  boost::function1<void, std::string> cb(boost::bind(&cond::RelationalAuthenticationService::RelationalAuthenticationService::setAuthenticationPath, this, _1));
32 
33  coral::Property* pm = dynamic_cast<coral::Property*>(coral::Context::instance().PropertyManager().property(Auth::COND_AUTH_PATH_PROPERTY));
34  if(pm){
35  setAuthenticationPath( pm->get() );
36  m_callbackID = pm->registerCallback(cb);
37  }
38 }
static PFTauRenderPlugin instance
static const std::string COND_AUTH_PATH_PROPERTY
Definition: Auth.h:27
void setAuthenticationPath(const std::string &inputPath)
Sets the input file name.
list key
Definition: combine.py:13
CredentialStore m_db
The service providing the authentication data.
cond::RelationalAuthenticationService::RelationalAuthenticationService::~RelationalAuthenticationService ( )
virtual

Standard Destructor.

Definition at line 40 of file RelationalAuthenticationService.cc.

41 {
42 }

Member Function Documentation

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, log, producerFileCleanner::msg, AlCaHLTBitMon_QueryRunRegistry::string, and cond::throwException().

53 {
54  const coral::IAuthenticationCredentials* creds = m_cache.get( connectionString );
55  if( !creds ){
56  std::string credsStoreConn = m_db.setUpForConnectionString( connectionString, m_authenticationPath );
57  coral::MessageStream log("cond::RelationalAuthenticationService::credentials");
58  log << coral::Debug << "Connecting to the credential repository in \"" << credsStoreConn << "\" with principal \""<<m_db.keyPrincipalName()<<"\"."<<coral::MessageStream::endmsg;
60  }
61  creds = m_cache.get( connectionString );
62  if( ! creds ){
63  std::string msg("Connection to \"");
64  msg += connectionString + "\"";
65  msg += " with role \"COND_DEFAULT_ROLE\" is not available for ";
67  cond::throwException( msg, "cond::RelationalAuthenticationService::RelationalAuthenticationService::credentials" );
68  }
69  return *creds;
70 }
const std::string & keyPrincipalName()
static std::vector< std::string > checklist log
std::string setUpForConnectionString(const std::string &connectionString, const std::string &authPath)
bool selectForUser(coral_bridge::AuthenticationCredentialSet &destinationData)
void throwException(std::string const &message, std::string const &methodName)
Definition: Exception.cc:17
const coral::IAuthenticationCredentials * get(const std::string &connectionString) const
CredentialStore m_db
The service providing the authentication data.
const bool Debug
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 73 of file RelationalAuthenticationService.cc.

References Debug, log, producerFileCleanner::msg, AlCaHLTBitMon_QueryRunRegistry::string, and cond::throwException().

75 {
76  const coral::IAuthenticationCredentials* creds = m_cache.get( connectionString, role );
77  if( !creds ){
78  std::string credsStoreConn = m_db.setUpForConnectionString( connectionString, m_authenticationPath );
79  coral::MessageStream log("cond::RelationalAuthenticationService::credentials");
80  log << coral::Debug << "Connecting to the credential repository in \"" << credsStoreConn << "\" with principal \""<<m_db.keyPrincipalName()<<"\"."<<coral::MessageStream::endmsg;
82  }
83  creds = m_cache.get( connectionString, role );
84  if( ! creds ){
85  std::string msg("Connection to \"");
86  msg += connectionString + "\"";
87  msg += " with role \"" + role + "\" is not available for ";
89  cond::throwException( msg, "cond::RelationalAuthenticationService::RelationalAuthenticationService::credentials" );
90  }
91  return *creds;
92 }
const std::string & keyPrincipalName()
static std::vector< std::string > checklist log
std::string setUpForConnectionString(const std::string &connectionString, const std::string &authPath)
bool selectForUser(coral_bridge::AuthenticationCredentialSet &destinationData)
void throwException(std::string const &message, std::string const &methodName)
Definition: Exception.cc:17
const coral::IAuthenticationCredentials * get(const std::string &connectionString) const
CredentialStore m_db
The service providing the authentication data.
const bool Debug
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().

Member Data Documentation

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
mutableprivate

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
mutableprivate

The service providing the authentication data.

Definition at line 62 of file RelationalAuthenticationService.h.