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, create_public_lumi_plots::log, lumiQueryAPI::msg, and AlCaHLTBitMon_QueryRunRegistry::string.

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("No Authentication available for connection=\"");
64  msg += connectionString + "\".";
65  throw coral::AuthenticationServiceException( msg, "cond::RelationalAuthenticationService::RelationalAuthenticationService::credentials", "");
66  }
67  return *creds;
68 }
const std::string & keyPrincipalName()
std::string setUpForConnectionString(const std::string &connectionString, const std::string &authPath)
bool selectForUser(coral_bridge::AuthenticationCredentialSet &destinationData)
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 71 of file RelationalAuthenticationService.cc.

References Debug, create_public_lumi_plots::log, lumiQueryAPI::msg, and AlCaHLTBitMon_QueryRunRegistry::string.

73 {
74  const coral::IAuthenticationCredentials* creds = m_cache.get( connectionString, role );
75  if( !creds ){
76  std::string credsStoreConn = m_db.setUpForConnectionString( connectionString, m_authenticationPath );
77  coral::MessageStream log("cond::RelationalAuthenticationService::credentials");
78  log << coral::Debug << "Connecting to the credential repository in \"" << credsStoreConn << "\" with principal \""<<m_db.keyPrincipalName()<<"\"."<<coral::MessageStream::endmsg;
80  }
81  creds = m_cache.get( connectionString, role );
82  if( ! creds ){
83  std::string msg("No Authentication available for connection=\"");
84  msg += connectionString + "\".";
85  msg += " and role=\"" + role + "\".";
86  throw coral::AuthenticationServiceException( msg, "cond::RelationalAuthenticationService::RelationalAuthenticationService::credentials","");
87  }
88  return *creds;
89 }
const std::string & keyPrincipalName()
std::string setUpForConnectionString(const std::string &connectionString, const std::string &authPath)
bool selectForUser(coral_bridge::AuthenticationCredentialSet &destinationData)
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.