test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DecodingKey.h
Go to the documentation of this file.
1 #ifndef CondCore_CondDB_DecodingKey_h
2 #define CondCore_CondDB_DecodingKey_h
3 
4 #include <iostream>
5 #include <string>
6 #include <set>
7 #include <map>
8 
9 namespace cond {
10 
11  namespace auth {
12 
18  };
19 
20  class KeyGenerator {
21  public:
22 
23  KeyGenerator();
24 
25  std::string make( size_t keySize );
27 
28  private:
29 
31 
32  };
33 
34  class DecodingKey {
35 
36  public:
37 
38  static constexpr const char* const FILE_NAME = "db.key";
39  static constexpr const char* const FILE_PATH = ".cms_cond/db.key";
40  static constexpr size_t DEFAULT_KEY_SIZE = 100;
41 
42  static std::string templateFile();
43 
44  public:
45 
46  DecodingKey();
47 
48  virtual ~DecodingKey(){}
49 
50  size_t init( const std::string& keyFileName, const std::string& password, bool readMode = true );
51 
52  size_t createFromInputFile( const std::string& inputFileName, size_t generatedKeySize = 0 );
53 
54  void list( std::ostream& out );
55 
56  void flush();
57 
58  const std::string& principalName() const;
59 
60  const std::string& principalKey() const;
61 
62  bool isNominal() const;
63 
64  const std::string& ownerName() const;
65 
66  const std::map< std::string, ServiceCredentials >& services() const;
67 
69 
70  void addService( const std::string& serviceName, const std::string& connectionString, const std::string& userName, const std::string& password );
71 
72 
73  private:
74 
76 
77  bool m_mode;
78 
80 
82 
84 
86 
87  std::map< std::string, ServiceCredentials > m_services;
88 
89  };
90  }
91 }
92 
93 inline
95 }
96 
97 inline
99 }
100 
101 inline
102 cond::auth::DecodingKey::DecodingKey():m_fileName(""),m_mode( true ),m_pwd(""),m_principalName(""),m_principalKey(""),m_owner(""),m_services(){
103 }
104 
105 inline
106 const std::string&
108  return m_principalName;
109 }
110 
111 inline
112 const std::string&
114  return m_principalKey;
115 }
116 
117 inline
118 bool
120  return !m_owner.empty();
121 }
122 
123 inline
124 const std::string&
126  return m_owner;
127 }
128 
129 inline
130 const std::map< std::string, cond::auth::ServiceCredentials >&
131 cond::auth::DecodingKey::services() const { return m_services; }
132 
133 #endif // CondCore_CondDB_DecodingKey_h
134 
135 
136 
size_t init(const std::string &keyFileName, const std::string &password, bool readMode=true)
Definition: DecodingKey.cc:108
void addService(const std::string &serviceName, const std::string &connectionString, const std::string &userName, const std::string &password)
Definition: DecodingKey.cc:287
const std::map< std::string, ServiceCredentials > & services() const
Definition: DecodingKey.h:131
static const std::string serviceName
const std::string & ownerName() const
Definition: DecodingKey.h:125
size_t createFromInputFile(const std::string &inputFileName, size_t generatedKeySize=0)
Definition: DecodingKey.cc:186
#define constexpr
std::string m_fileName
Definition: DecodingKey.h:75
bool isNominal() const
Definition: DecodingKey.h:119
static std::string templateFile()
Definition: DecodingKey.cc:96
tuple maxSize
&#39;/store/data/Commissioning08/BeamHalo/RECO/StuffAlmostToP5_v1/000/061/642/10A0FE34-A67D-DD11-AD05-000...
std::map< std::string, ServiceCredentials > m_services
Definition: DecodingKey.h:87
const std::string & principalName() const
Definition: DecodingKey.h:107
void addDefaultService(const std::string &connectionString)
Definition: DecodingKey.cc:283
std::string m_principalName
Definition: DecodingKey.h:81
string connectionString
Definition: autoCondHLT.py:4
static constexpr size_t DEFAULT_KEY_SIZE
Definition: DecodingKey.h:40
std::string makeWithRandomSize(size_t maxSize)
Definition: DecodingKey.cc:87
std::string make(size_t keySize)
Definition: DecodingKey.cc:74
std::string m_principalKey
Definition: DecodingKey.h:83
static constexpr const char *const FILE_NAME
Definition: DecodingKey.h:38
void list(std::ostream &out)
Definition: DecodingKey.cc:235
static constexpr const char *const FILE_PATH
Definition: DecodingKey.h:39
const std::string & principalKey() const
Definition: DecodingKey.h:113