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  DataSourceEntry() = delete;
32  DataSourceEntry(const DataSourceEntry&) = delete;
33  DataSourceEntry& operator=(const DataSourceEntry&) = delete;
34 
37 
42 
46  void appendCredentialItemForRole(const std::string& item, const std::string& value, const std::string& role);
47 
51  const coral::IAuthenticationCredentials& credentials() const;
52 
57  const coral::IAuthenticationCredentials& credentials(const std::string& role) const;
58 
59  private:
62 
65 
67  coral::AuthenticationCredentials* m_default;
68 
70  std::map<std::string, coral::AuthenticationCredentials*> m_data;
71  };
72 
78  class XMLAuthenticationService : public coral::Service, virtual public coral::IAuthenticationService {
79  public:
81  explicit XMLAuthenticationService(const std::string& name);
82 
84  ~XMLAuthenticationService() override;
85 
86  public:
91  const coral::IAuthenticationCredentials& credentials(const std::string& connectionString) const override;
92 
98  const coral::IAuthenticationCredentials& credentials(const std::string& connectionString,
99  const std::string& role) const override;
100 
101  public:
104 
105  private:
107  bool initialize();
108 
110  void reset();
111 
114 
116  std::set<std::string> verifyFileName();
117 
120 
123 
125  std::map<std::string, DataSourceEntry*> m_data;
126 
129 
130  coral::Property::CallbackID m_callbackID;
131  };
132 
133  } // namespace XMLAuthenticationService
134 
135 } // namespace cond
136 
137 #endif
void appendCredentialItemForRole(const std::string &item, const std::string &value, const std::string &role)
const coral::IAuthenticationCredentials & credentials() const
bool initialize()
Service framework related initialization.
static std::mutex mutex
Definition: Proxy.cc:8
std::map< std::string, DataSourceEntry * > m_data
The structure with the authentication data.
const coral::IAuthenticationCredentials & credentials(const std::string &connectionString) const override
static const std::string serviceName
bool m_isInitialized
Flag indicating whether the service has been initialized.
std::set< std::string > verifyFileName()
Verifies the existence of the authentication files.
coral::AuthenticationCredentials * m_default
The input file with the data.
XMLAuthenticationService(const std::string &name)
Standard Constructor.
void setAuthenticationPath(const std::string &inputPath)
Sets the input file name.
Definition: Binary.h:9
Definition: value.py:1
bool processFile(const std::string &inputFileName)
Parses an xml file.
void appendCredentialItem(const std::string &item, const std::string &value)
std::map< std::string, coral::AuthenticationCredentials * > m_data
The structure with the authentication data for the various roles.
DataSourceEntry & operator=(const DataSourceEntry &)=delete
std::string m_inputFileName
The input file with the data.