CMS 3D CMS Logo

XMLAuthenticationService.h
Go to the documentation of this file.
1 #ifndef COND_XMLAUTHENTITACTIONSERVICE_H
2 #define COND_XMLAUTHENTITACTIONSERVICE_H
3 
4 #include "RelationalAccess/IAuthenticationService.h"
5 #include "CoralKernel/Service.h"
6 #include "CoralKernel/Property.h"
7 #include <map>
8 #include <set>
9 #include <string>
10 #include <boost/thread.hpp>
11 
12 namespace coral {
13 
14  class AuthenticationCredentials;
15  //class IAuthenticationCredentials;
16 } // namespace coral
17 
18 namespace cond {
19 
21 
28  public:
30  DataSourceEntry(const std::string& serviceName, const std::string& connectionName);
31 
34 
39 
43  void appendCredentialItemForRole(const std::string& item, const std::string& value, const std::string& role);
44 
48  const coral::IAuthenticationCredentials& credentials() const;
49 
54  const coral::IAuthenticationCredentials& credentials(const std::string& role) const;
55 
56  private:
59 
62 
64  coral::AuthenticationCredentials* m_default;
65 
67  std::map<std::string, coral::AuthenticationCredentials*> m_data;
68 
69  private:
70  DataSourceEntry() = delete;
71  DataSourceEntry(const DataSourceEntry&) = delete;
72  DataSourceEntry& operator=(const DataSourceEntry&) = delete;
73  };
74 
80  class XMLAuthenticationService : public coral::Service, virtual public coral::IAuthenticationService {
81  public:
83  explicit XMLAuthenticationService(const std::string& name);
84 
86  ~XMLAuthenticationService() override;
87 
88  public:
93  const coral::IAuthenticationCredentials& credentials(const std::string& connectionString) const override;
94 
100  const coral::IAuthenticationCredentials& credentials(const std::string& connectionString,
101  const std::string& role) const override;
102 
103  public:
106 
107  private:
109  bool initialize();
110 
112  void reset();
113 
116 
118  std::set<std::string> verifyFileName();
119 
122 
125 
127  std::map<std::string, DataSourceEntry*> m_data;
128 
131 
132  coral::Property::CallbackID m_callbackID;
133  };
134 
135  } // namespace XMLAuthenticationService
136 
137 } // namespace cond
138 
139 #endif
cond::XMLAuthenticationService::DataSourceEntry::operator=
DataSourceEntry & operator=(const DataSourceEntry &)=delete
cond::XMLAuthenticationService::XMLAuthenticationService::reset
void reset()
Reset parsed data.
Definition: XMLAuthenticationService.cc:337
cond::XMLAuthenticationService::DataSourceEntry
Definition: XMLAuthenticationService.h:27
cond::XMLAuthenticationService::XMLAuthenticationService::m_mutexLock
boost::mutex m_mutexLock
the mutex lock
Definition: XMLAuthenticationService.h:130
cond::XMLAuthenticationService::XMLAuthenticationService::~XMLAuthenticationService
~XMLAuthenticationService() override
Standard Destructor.
Definition: XMLAuthenticationService.cc:90
serviceName
static const std::string serviceName
Definition: CredentialStore.cc:31
cond::XMLAuthenticationService::DataSourceEntry::m_connectionName
std::string m_connectionName
The connection name.
Definition: XMLAuthenticationService.h:61
cond::XMLAuthenticationService::XMLAuthenticationService
Definition: XMLAuthenticationService.h:80
cond::XMLAuthenticationService::XMLAuthenticationService::m_inputFileName
std::string m_inputFileName
The input file with the data.
Definition: XMLAuthenticationService.h:124
cond::XMLAuthenticationService::DataSourceEntry::DataSourceEntry
DataSourceEntry()=delete
InefficientDoubleROC.inputFileName
inputFileName
Definition: InefficientDoubleROC.py:437
coral
Definition: Binary.h:9
cond::XMLAuthenticationService::XMLAuthenticationService::m_data
std::map< std::string, DataSourceEntry * > m_data
The structure with the authentication data.
Definition: XMLAuthenticationService.h:127
cond::XMLAuthenticationService::DataSourceEntry::~DataSourceEntry
~DataSourceEntry()
Destructor.
Definition: XMLAuthenticationService.cc:38
cond::XMLAuthenticationService::DataSourceEntry::m_serviceName
std::string m_serviceName
The service name.
Definition: XMLAuthenticationService.h:58
cond::XMLAuthenticationService::DataSourceEntry::m_data
std::map< std::string, coral::AuthenticationCredentials * > m_data
The structure with the authentication data for the various roles.
Definition: XMLAuthenticationService.h:67
cond
Definition: plugin.cc:23
cond::XMLAuthenticationService::DataSourceEntry::appendCredentialItemForRole
void appendCredentialItemForRole(const std::string &item, const std::string &value, const std::string &role)
Definition: XMLAuthenticationService.cc:50
mutex
static std::mutex mutex
Definition: Proxy.cc:8
value
Definition: value.py:1
cond::XMLAuthenticationService::XMLAuthenticationService::verifyFileName
std::set< std::string > verifyFileName()
Verifies the existence of the authentication files.
Definition: XMLAuthenticationService.cc:372
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
cond::XMLAuthenticationService::DataSourceEntry::credentials
const coral::IAuthenticationCredentials & credentials() const
Definition: XMLAuthenticationService.cc:60
cond::XMLAuthenticationService::XMLAuthenticationService::initialize
bool initialize()
Service framework related initialization.
Definition: XMLAuthenticationService.cc:299
cond::XMLAuthenticationService::DataSourceEntry::appendCredentialItem
void appendCredentialItem(const std::string &item, const std::string &value)
Definition: XMLAuthenticationService.cc:45
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cond::XMLAuthenticationService::XMLAuthenticationService::m_callbackID
coral::Property::CallbackID m_callbackID
Definition: XMLAuthenticationService.h:132
cond::XMLAuthenticationService::XMLAuthenticationService::processFile
bool processFile(const std::string &inputFileName)
Parses an xml file.
Definition: XMLAuthenticationService.cc:107
SiStripCommissioningSource_FromEDM_cfg.inputPath
inputPath
Definition: SiStripCommissioningSource_FromEDM_cfg.py:8
cond::XMLAuthenticationService::XMLAuthenticationService::XMLAuthenticationService
XMLAuthenticationService(const std::string &name)
Standard Constructor.
Definition: XMLAuthenticationService.cc:77
cond::XMLAuthenticationService::XMLAuthenticationService::m_isInitialized
bool m_isInitialized
Flag indicating whether the service has been initialized.
Definition: XMLAuthenticationService.h:121
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
cond::XMLAuthenticationService::XMLAuthenticationService::setAuthenticationPath
void setAuthenticationPath(const std::string &inputPath)
Sets the input file name.
Definition: XMLAuthenticationService.cc:97
cond::XMLAuthenticationService::XMLAuthenticationService::credentials
const coral::IAuthenticationCredentials & credentials(const std::string &connectionString) const override
Definition: XMLAuthenticationService.cc:346
l1RCTOmdsFedVectorProducer_cfi.connectionString
connectionString
Definition: l1RCTOmdsFedVectorProducer_cfi.py:4
cond::XMLAuthenticationService::DataSourceEntry::m_default
coral::AuthenticationCredentials * m_default
The input file with the data.
Definition: XMLAuthenticationService.h:64