CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
cond::RelationalAuthenticationService::RelationalAuthenticationService Class Reference

#include <RelationalAuthenticationService.h>

Inheritance diagram for cond::RelationalAuthenticationService::RelationalAuthenticationService:
cond::persistency::IDbAuthentication

Public Member Functions

const coral::IAuthenticationCredentials & credentials (const std::string &connectionString) const override
 
const coral::IAuthenticationCredentials & credentials (const std::string &connectionString, const std::string &role) const override
 
std::string principalName () override
 
 RelationalAuthenticationService (const std::string &name)
 Standard Constructor. More...
 
void setAuthenticationPath (const std::string &inputPath)
 Sets the input file name. More...
 
 ~RelationalAuthenticationService () override
 Standard Destructor. More...
 
- Public Member Functions inherited from cond::persistency::IDbAuthentication
virtual ~IDbAuthentication ()
 

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 27 of file RelationalAuthenticationService.h.

Constructor & Destructor Documentation

◆ RelationalAuthenticationService()

cond::RelationalAuthenticationService::RelationalAuthenticationService::RelationalAuthenticationService ( const std::string &  name)
explicit

Standard Constructor.

Definition at line 23 of file RelationalAuthenticationService.cc.

25  : coral::Service(key), m_authenticationPath(""), m_db(), m_cache(), m_callbackID(0) {
26  boost::function1<void, std::string> cb(boost::bind(
28 
29  coral::Property* pm = dynamic_cast<coral::Property*>(
30  coral::Context::instance().PropertyManager().property(auth::COND_AUTH_PATH_PROPERTY));
31  if (pm) {
32  setAuthenticationPath(pm->get());
33  m_callbackID = pm->registerCallback(cb);
34  }
35 }

References cond::auth::COND_AUTH_PATH_PROPERTY, instance, m_callbackID, and setAuthenticationPath().

◆ ~RelationalAuthenticationService()

cond::RelationalAuthenticationService::RelationalAuthenticationService::~RelationalAuthenticationService ( )
override

Standard Destructor.

Definition at line 37 of file RelationalAuthenticationService.cc.

37 {}

Member Function Documentation

◆ credentials() [1/2]

const coral::IAuthenticationCredentials & cond::RelationalAuthenticationService::RelationalAuthenticationService::credentials ( const std::string &  connectionString) const
override

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 46 of file RelationalAuthenticationService.cc.

47  {
48  const coral::IAuthenticationCredentials* creds = m_cache.get(connectionString);
49  if (!creds) {
51  coral::MessageStream log("cond::RelationalAuthenticationService::credentials");
52  log << coral::Debug << "Connecting to the credential repository in \"" << credsStoreConn << "\" with principal \""
53  << m_db.keyPrincipalName() << "\"." << coral::MessageStream::endmsg;
55  }
56  creds = m_cache.get(connectionString);
57  if (!creds) {
58  std::string msg("Connection to \"");
59  msg += connectionString + "\"";
60  msg += " with role \"COND_DEFAULT_ROLE\" is not available for ";
62  cond::throwException(msg, "cond::RelationalAuthenticationService::RelationalAuthenticationService::credentials");
63  }
64  return *creds;
65 }

References l1RCTOmdsFedVectorProducer_cfi::connectionString, Debug, dqm-mbProfile::log, mps_check::msg, AlCaHLTBitMon_QueryRunRegistry::string, and cond::throwException().

◆ credentials() [2/2]

const coral::IAuthenticationCredentials & cond::RelationalAuthenticationService::RelationalAuthenticationService::credentials ( const std::string &  connectionString,
const std::string &  role 
) const
override

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 68 of file RelationalAuthenticationService.cc.

69  {
70  const coral::IAuthenticationCredentials* creds = m_cache.get(connectionString, role);
71  if (!creds) {
73  coral::MessageStream log("cond::RelationalAuthenticationService::credentials");
74  log << coral::Debug << "Connecting to the credential repository in \"" << credsStoreConn << "\" with principal \""
75  << m_db.keyPrincipalName() << "\"." << coral::MessageStream::endmsg;
77  }
78  creds = m_cache.get(connectionString, role);
79  if (!creds) {
80  std::string msg("Connection to \"");
81  msg += connectionString + "\"";
82  msg += " with role \"" + role + "\" is not available for ";
84  cond::throwException(msg, "cond::RelationalAuthenticationService::RelationalAuthenticationService::credentials");
85  }
86  return *creds;
87 }

References l1RCTOmdsFedVectorProducer_cfi::connectionString, Debug, dqm-mbProfile::log, mps_check::msg, AlCaHLTBitMon_QueryRunRegistry::string, and cond::throwException().

◆ principalName()

std::string cond::RelationalAuthenticationService::RelationalAuthenticationService::principalName ( )
overridevirtual

Implements cond::persistency::IDbAuthentication.

Definition at line 89 of file RelationalAuthenticationService.cc.

89  {
90  return m_db.keyPrincipalName();
91 }

◆ setAuthenticationPath()

void cond::RelationalAuthenticationService::RelationalAuthenticationService::setAuthenticationPath ( const std::string &  inputPath)

Sets the input file name.

Definition at line 39 of file RelationalAuthenticationService.cc.

40  {
42  m_cache.reset();
43 }

References SiStripCommissioningSource_FromEDM_cfg::inputPath.

Referenced by RelationalAuthenticationService().

Member Data Documentation

◆ m_authenticationPath

std::string cond::RelationalAuthenticationService::RelationalAuthenticationService::m_authenticationPath
private

The input file with the data.

Definition at line 59 of file RelationalAuthenticationService.h.

◆ m_cache

coral_bridge::AuthenticationCredentialSet cond::RelationalAuthenticationService::RelationalAuthenticationService::m_cache
mutableprivate

Definition at line 64 of file RelationalAuthenticationService.h.

◆ m_callbackID

coral::Property::CallbackID cond::RelationalAuthenticationService::RelationalAuthenticationService::m_callbackID
private

Definition at line 66 of file RelationalAuthenticationService.h.

Referenced by RelationalAuthenticationService().

◆ m_db

CredentialStore cond::RelationalAuthenticationService::RelationalAuthenticationService::m_db
mutableprivate

The service providing the authentication data.

Definition at line 62 of file RelationalAuthenticationService.h.

cond::RelationalAuthenticationService::RelationalAuthenticationService::m_authenticationPath
std::string m_authenticationPath
The input file with the data.
Definition: RelationalAuthenticationService.h:59
cond::CredentialStore::keyPrincipalName
const std::string & keyPrincipalName()
Definition: CredentialStore.cc:1535
cond::RelationalAuthenticationService::RelationalAuthenticationService::setAuthenticationPath
void setAuthenticationPath(const std::string &inputPath)
Sets the input file name.
Definition: RelationalAuthenticationService.cc:39
mps_check.msg
tuple msg
Definition: mps_check.py:285
coral_bridge::AuthenticationCredentialSet::get
const coral::IAuthenticationCredentials * get(const std::string &connectionString) const
Definition: CredentialStore.cc:97
cond::CredentialStore::selectForUser
bool selectForUser(coral_bridge::AuthenticationCredentialSet &destinationData)
Definition: CredentialStore.cc:1183
cond::RelationalAuthenticationService::RelationalAuthenticationService::m_callbackID
coral::Property::CallbackID m_callbackID
Definition: RelationalAuthenticationService.h:66
Debug
const bool Debug
Definition: CosmicMuonParameters.h:12
cond::CredentialStore::setUpForConnectionString
std::string setUpForConnectionString(const std::string &connectionString, const std::string &authPath)
Definition: CredentialStore.cc:760
coral_bridge::AuthenticationCredentialSet::reset
void reset()
Definition: CredentialStore.cc:37
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cond::RelationalAuthenticationService::RelationalAuthenticationService::m_cache
coral_bridge::AuthenticationCredentialSet m_cache
Definition: RelationalAuthenticationService.h:64
cond::RelationalAuthenticationService::RelationalAuthenticationService::m_db
CredentialStore m_db
The service providing the authentication data.
Definition: RelationalAuthenticationService.h:62
instance
static PFTauRenderPlugin instance
Definition: PFTauRenderPlugin.cc:70
SiStripCommissioningSource_FromEDM_cfg.inputPath
inputPath
Definition: SiStripCommissioningSource_FromEDM_cfg.py:8
cond::auth::COND_AUTH_PATH_PROPERTY
static constexpr const char *const COND_AUTH_PATH_PROPERTY
Definition: Auth.h:43
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
l1RCTOmdsFedVectorProducer_cfi.connectionString
connectionString
Definition: l1RCTOmdsFedVectorProducer_cfi.py:4
crabWrapper.key
key
Definition: crabWrapper.py:19
cond::throwException
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:18