Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:01:25

0001 #ifndef COND_XMLAUTHENTITACTIONSERVICE_H
0002 #define COND_XMLAUTHENTITACTIONSERVICE_H
0003 
0004 #include "CondCore/CondDB/interface/CredentialStore.h"
0005 #include "CondCore/CondDB/src/IDbAuthentication.h"
0006 //
0007 #include "RelationalAccess/IAuthenticationService.h"
0008 #include "CoralKernel/Service.h"
0009 #include "CoralKernel/Property.h"
0010 //
0011 #include <map>
0012 #include <set>
0013 #include <string>
0014 
0015 namespace coral {
0016 
0017   class AuthenticationCredentials;
0018   //class IAuthenticationCredentials;
0019 }  // namespace coral
0020 
0021 namespace cond {
0022 
0023   namespace RelationalAuthenticationService {
0024 
0025     /**
0026      */
0027     class RelationalAuthenticationService : public coral::Service,
0028                                             virtual public coral::IAuthenticationService,
0029                                             virtual public persistency::IDbAuthentication {
0030     public:
0031       /// Standard Constructor
0032       explicit RelationalAuthenticationService(const std::string& name);
0033 
0034       /// Standard Destructor
0035       ~RelationalAuthenticationService() override;
0036 
0037     public:
0038       /// Sets the input file name
0039       void setAuthenticationPath(const std::string& inputPath);
0040 
0041       /**
0042        * Returns a reference to the credentials object for a given connection string.
0043        * If the connection string is not known to the service an UnknownConnectionException is thrown.
0044        */
0045       const coral::IAuthenticationCredentials& credentials(const std::string& connectionString) const override;
0046 
0047       /**
0048        * Returns a reference to the credentials object for a given connection string.
0049        * If the connection string is not known to the service an UnknownConnectionException is thrown.
0050        * If the role is not known to the service an UnknownRoleException is thrown.
0051        */
0052       const coral::IAuthenticationCredentials& credentials(const std::string& connectionString,
0053                                                            const std::string& role) const override;
0054 
0055       std::string principalName() override;
0056 
0057     private:
0058       /// The input file with the data
0059       std::string m_authenticationPath;
0060 
0061       /// The service providing the authentication data
0062       mutable CredentialStore m_db;
0063 
0064       mutable coral_bridge::AuthenticationCredentialSet m_cache;
0065 
0066       coral::Property::CallbackID m_callbackID;
0067     };
0068 
0069   }  // namespace RelationalAuthenticationService
0070 
0071 }  // namespace cond
0072 
0073 #endif