#include <CredentialStore.h>
Classes | |
struct | Permission |
Public Member Functions | |
bool | createSchema (const std::string &connectionString, const std::string &userName, const std::string &password) |
CredentialStore () | |
Standard Constructor. More... | |
bool | drop (const std::string &connectionString, const std::string &userName, const std::string &password) |
bool | exportAll (coral_bridge::AuthenticationCredentialSet &data) |
std::pair< std::string, std::string > | getUserCredentials (const std::string &connectionString, const std::string &role) |
bool | importForPrincipal (const std::string &principal, const coral_bridge::AuthenticationCredentialSet &data, bool forceUpdateConnection=false) |
import data More... | |
const std::string & | keyPrincipalName () |
bool | listConnections (std::map< std::string, std::pair< std::string, std::string > > &destination) |
bool | listPrincipals (std::vector< std::string > &destination) |
std::string | log () |
bool | removeConnection (const std::string &connectionLabel) |
bool | removePrincipal (const std::string &principal) |
bool | resetAdmin (const std::string &userName, const std::string &password) |
bool | selectForUser (coral_bridge::AuthenticationCredentialSet &destinationData) |
bool | selectPermissions (const std::string &principalName, const std::string &role, const std::string &connectionString, std::vector< Permission > &destination) |
const std::string & | serviceName () |
bool | setPermission (const std::string &principal, const std::string &role, const std::string &connectionString, const std::string &connectionLabel) |
std::string | setUpForConnectionString (const std::string &connectionString, const std::string &authPath) |
std::string | setUpForService (const std::string &serviceName, const std::string &authPath) |
Sets the initialization parameters. More... | |
size_t | unsetPermission (const std::string &principal, const std::string &role, const std::string &connectionString) |
bool | updateConnection (const std::string &connectionLabel, const std::string &userName, const std::string &password) |
bool | updatePrincipal (const std::string &principal, const std::string &principalKey, bool setAdmin=false) |
virtual | ~CredentialStore () |
Standard Destructor. More... | |
Static Public Attributes | |
static const std::string | DEFAULT_DATA_SOURCE |
Private Member Functions | |
void | closeSession (bool commit=true) |
std::pair< std::string, std::string > | openConnection (const std::string &connectionString) |
void | openSession (const std::string &schemaName, const std::string &userName, const std::string &password, bool readMode) |
void | openSession (bool readOnly=true) |
void | startSession (bool readMode) |
void | startSuperSession (const std::string &connectionString, const std::string &userName, const std::string &password) |
Private Attributes | |
std::string | m_authenticatedPrincipal |
std::shared_ptr < coral::IConnection > | m_connection |
auth::DecodingKey | m_key |
std::stringstream | m_log |
int | m_principalId |
std::string | m_principalKey |
const auth::ServiceCredentials * | m_serviceData |
std::string | m_serviceName |
std::shared_ptr< coral::ISession > | m_session |
Friends | |
class | CSScopedSession |
Definition at line 85 of file CredentialStore.h.
cond::CredentialStore::CredentialStore | ( | ) |
Standard Constructor.
Definition at line 746 of file CredentialStore.cc.
|
virtual |
|
private |
Definition at line 586 of file CredentialStore.cc.
bool cond::CredentialStore::createSchema | ( | const std::string & | connectionString, |
const std::string & | userName, | ||
const std::string & | password | ||
) |
Definition at line 817 of file CredentialStore.cc.
References addSequence(), ADMIN_KEY_COL(), AUTH_ID_COL(), AUTH_KEY_COL(), AUTHENTICATION_TABLE(), AUTHORIZATION_TABLE(), C_ID_COL(), cond::CSScopedSession::close(), cond::auth::COND_ADMIN_ROLE, cond::auth::COND_DB_KEY_SIZE, CONNECTION_ID_COL(), CONNECTION_KEY_COL(), CONNECTION_LABEL_COL(), autoCondModifiers::connectionString, gather_cfg::cout, CREDENTIAL_TABLE(), alignCSCRings::e, Exception, relval_steps::gen(), cond::auth::KeyGenerator::make(), P_ID_COL(), PASSWORD_COL(), PRINCIPAL_ID_COL(), PRINCIPAL_KEY_COL(), PRINCIPAL_NAME_COL(), runTheMatrix::ret, ROLE_COL(), SCHEMA_COL(), cond::schemaLabel(), SEQUENCE_NAME_COL(), SEQUENCE_TABLE(), SEQUENCE_VALUE_COL(), run_AlCaRecoTriggerBitsUpdateWorkflow::session, cond::setPermissionData(), cond::CSScopedSession::startSuper(), AlCaHLTBitMon_QueryRunRegistry::string, cond::throwException(), tname(), cond::updateConnectionData(), cond::updatePrincipalData(), USERNAME_COL(), VERIFICATION_COL(), and VERIFICATION_KEY_COL().
bool cond::CredentialStore::drop | ( | const std::string & | connectionString, |
const std::string & | userName, | ||
const std::string & | password | ||
) |
Definition at line 960 of file CredentialStore.cc.
References AUTHENTICATION_TABLE(), AUTHORIZATION_TABLE(), cond::CSScopedSession::close(), CREDENTIAL_TABLE(), SEQUENCE_TABLE(), run_AlCaRecoTriggerBitsUpdateWorkflow::session, cond::CSScopedSession::startSuper(), and tname().
bool cond::CredentialStore::exportAll | ( | coral_bridge::AuthenticationCredentialSet & | data | ) |
Definition at line 1525 of file CredentialStore.cc.
References AUTHORIZATION_TABLE(), cond::auth::Cipher::b64decrypt(), C_ID_COL(), cond::CSScopedSession::close(), CONNECTION_ID_COL(), CONNECTION_KEY_COL(), CONNECTION_LABEL_COL(), autoCondModifiers::connectionString, CREDENTIAL_TABLE(), newFWLiteAna::found, PASSWORD_COL(), contentValuesFiles::query, coral_bridge::AuthenticationCredentialSet::registerCredentials(), ROLE_COL(), SCHEMA_COL(), run_AlCaRecoTriggerBitsUpdateWorkflow::session, cond::CSScopedSession::start(), AlCaHLTBitMon_QueryRunRegistry::string, tname(), to_lower(), USERNAME_COL(), and VERIFICATION_KEY_COL().
std::pair< std::string, std::string > cond::CredentialStore::getUserCredentials | ( | const std::string & | connectionString, |
const std::string & | role | ||
) |
Definition at line 1288 of file CredentialStore.cc.
References AUTH_KEY_COL(), AUTHORIZATION_TABLE(), cond::auth::Cipher::b64decrypt(), C_ID_COL(), cond::CSScopedSession::close(), CONNECTION_ID_COL(), CONNECTION_LABEL_COL(), CREDENTIAL_TABLE(), P_ID_COL(), PASSWORD_COL(), contentValuesFiles::query, runTheMatrix::ret, ROLE_COL(), SCHEMA_COL(), run_AlCaRecoTriggerBitsUpdateWorkflow::session, cond::CSScopedSession::start(), AlCaHLTBitMon_QueryRunRegistry::string, tname(), to_lower(), USERNAME_COL(), and VERIFICATION_KEY_COL().
Referenced by cond::getDbCredentials().
bool cond::CredentialStore::importForPrincipal | ( | const std::string & | principal, |
const coral_bridge::AuthenticationCredentialSet & | data, | ||
bool | forceUpdateConnection = false |
||
) |
import data
Definition at line 1348 of file CredentialStore.cc.
References cond::PrincipalData::adminKey, cond::auth::Cipher::b64decrypt(), cond::CSScopedSession::close(), getInfo::conn, autoCondModifiers::connectionString, coral_bridge::AuthenticationCredentialSet::data(), newFWLiteAna::found, cond::PrincipalData::id, mps_check::msg, writedatasetfile::parser, cond::schemaLabel(), cond::selectPrincipal(), serviceName, run_AlCaRecoTriggerBitsUpdateWorkflow::session, cond::setPermissionData(), cond::CSScopedSession::start(), AlCaHLTBitMon_QueryRunRegistry::string, cond::throwException(), and cond::updateConnectionData().
const std::string & cond::CredentialStore::keyPrincipalName | ( | ) |
Definition at line 1584 of file CredentialStore.cc.
Referenced by cond::getDbCredentials().
bool cond::CredentialStore::listConnections | ( | std::map< std::string, std::pair< std::string, std::string > > & | destination | ) |
Definition at line 1419 of file CredentialStore.cc.
References cond::auth::Cipher::b64decrypt(), cond::CSScopedSession::close(), CONNECTION_KEY_COL(), CONNECTION_LABEL_COL(), CREDENTIAL_TABLE(), cmsStageWithFailover::destination, newFWLiteAna::found, PASSWORD_COL(), contentValuesFiles::query, run_AlCaRecoTriggerBitsUpdateWorkflow::session, cond::CSScopedSession::start(), AlCaHLTBitMon_QueryRunRegistry::string, tname(), USERNAME_COL(), and VERIFICATION_KEY_COL().
bool cond::CredentialStore::listPrincipals | ( | std::vector< std::string > & | destination | ) |
Definition at line 1398 of file CredentialStore.cc.
References AUTHENTICATION_TABLE(), cond::CSScopedSession::close(), newFWLiteAna::found, PRINCIPAL_NAME_COL(), contentValuesFiles::query, run_AlCaRecoTriggerBitsUpdateWorkflow::session, cond::CSScopedSession::start(), AlCaHLTBitMon_QueryRunRegistry::string, and tname().
std::string cond::CredentialStore::log | ( | ) |
Definition at line 1586 of file CredentialStore.cc.
Referenced by conddbCopyTest.CopyTest::execute(), and conditionUploadTest.UploadTest::upload().
|
private |
Definition at line 605 of file CredentialStore.cc.
References instance.
|
private |
Definition at line 619 of file CredentialStore.cc.
|
private |
bool cond::CredentialStore::removeConnection | ( | const std::string & | connectionLabel | ) |
Definition at line 1195 of file CredentialStore.cc.
References AUTHORIZATION_TABLE(), C_ID_COL(), cond::CSScopedSession::close(), CONNECTION_ID_COL(), CREDENTIAL_TABLE(), newFWLiteAna::found, cond::CredentialData::id, mps_check::msg, cond::selectConnection(), run_AlCaRecoTriggerBitsUpdateWorkflow::session, cond::CSScopedSession::start(), AlCaHLTBitMon_QueryRunRegistry::string, cond::throwException(), and tname().
bool cond::CredentialStore::removePrincipal | ( | const std::string & | principal | ) |
Definition at line 1159 of file CredentialStore.cc.
References AUTHENTICATION_TABLE(), AUTHORIZATION_TABLE(), cond::CSScopedSession::close(), newFWLiteAna::found, cond::PrincipalData::id, mps_check::msg, P_ID_COL(), PRINCIPAL_ID_COL(), cond::selectPrincipal(), run_AlCaRecoTriggerBitsUpdateWorkflow::session, cond::CSScopedSession::start(), AlCaHLTBitMon_QueryRunRegistry::string, cond::throwException(), and tname().
bool cond::CredentialStore::resetAdmin | ( | const std::string & | userName, |
const std::string & | password | ||
) |
Definition at line 976 of file CredentialStore.cc.
References cond::auth::Cipher::b64decrypt(), cond::CSScopedSession::close(), cond::auth::COND_ADMIN_ROLE, autoCondModifiers::connectionString, mps_check::msg, AlCaHLTBitMon_ParallelJobs::p, cond::PrincipalData::principalKey, runTheMatrix::ret, cond::schemaLabel(), cond::selectPrincipal(), run_AlCaRecoTriggerBitsUpdateWorkflow::session, cond::setPermissionData(), cond::CSScopedSession::startSuper(), AlCaHLTBitMon_QueryRunRegistry::string, cond::throwException(), cond::updateConnectionData(), and cond::updatePrincipalData().
bool cond::CredentialStore::selectForUser | ( | coral_bridge::AuthenticationCredentialSet & | destinationData | ) |
Definition at line 1230 of file CredentialStore.cc.
References AUTH_KEY_COL(), AUTHORIZATION_TABLE(), cond::auth::Cipher::b64decrypt(), C_ID_COL(), cond::CSScopedSession::close(), CONNECTION_ID_COL(), CONNECTION_LABEL_COL(), autoCondModifiers::connectionString, CREDENTIAL_TABLE(), P_ID_COL(), PASSWORD_COL(), contentValuesFiles::query, coral_bridge::AuthenticationCredentialSet::registerCredentials(), ROLE_COL(), SCHEMA_COL(), run_AlCaRecoTriggerBitsUpdateWorkflow::session, cond::CSScopedSession::start(), AlCaHLTBitMon_QueryRunRegistry::string, tname(), to_lower(), USERNAME_COL(), and VERIFICATION_KEY_COL().
bool cond::CredentialStore::selectPermissions | ( | const std::string & | principalName, |
const std::string & | role, | ||
const std::string & | connectionString, | ||
std::vector< Permission > & | destination | ||
) |
Definition at line 1463 of file CredentialStore.cc.
References AUTHENTICATION_TABLE(), AUTHORIZATION_TABLE(), C_ID_COL(), cond::CSScopedSession::close(), CONNECTION_ID_COL(), CONNECTION_LABEL_COL(), cond::CredentialStore::Permission::connectionLabel, cond::CredentialStore::Permission::connectionString, CREDENTIAL_TABLE(), newFWLiteAna::found, P_ID_COL(), PRINCIPAL_ID_COL(), PRINCIPAL_NAME_COL(), cond::CredentialStore::Permission::principalName, contentValuesFiles::query, cond::CredentialStore::Permission::role, ROLE_COL(), SCHEMA_COL(), run_AlCaRecoTriggerBitsUpdateWorkflow::session, cond::CSScopedSession::start(), AlCaHLTBitMon_QueryRunRegistry::string, tname(), and to_lower().
const std::string & cond::CredentialStore::serviceName | ( | ) |
Definition at line 1582 of file CredentialStore.cc.
bool cond::CredentialStore::setPermission | ( | const std::string & | principal, |
const std::string & | role, | ||
const std::string & | connectionString, | ||
const std::string & | connectionLabel | ||
) |
Definition at line 1052 of file CredentialStore.cc.
References cond::PrincipalData::adminKey, cond::auth::Cipher::b64decrypt(), cond::CSScopedSession::close(), cond::CredentialData::connectionKey, autoCondModifiers::connectionString, newFWLiteAna::found, cond::PrincipalData::id, cond::CredentialData::id, mps_check::msg, runTheMatrix::ret, cond::selectConnection(), cond::selectPrincipal(), run_AlCaRecoTriggerBitsUpdateWorkflow::session, cond::setPermissionData(), cond::CSScopedSession::start(), AlCaHLTBitMon_QueryRunRegistry::string, and cond::throwException().
std::string cond::CredentialStore::setUpForConnectionString | ( | const std::string & | connectionString, |
const std::string & | authPath | ||
) |
Definition at line 791 of file CredentialStore.cc.
References instance, serviceName, and AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by cond::getDbCredentials().
std::string cond::CredentialStore::setUpForService | ( | const std::string & | serviceName, |
const std::string & | authPath | ||
) |
Sets the initialization parameters.
Definition at line 759 of file CredentialStore.cc.
References cond::auth::COND_KEY, mergeVDriftHistosByStation::file, cond::auth::DecodingKey::FILE_PATH, contentValuesFiles::fullPath, mps_check::msg, fed_dqm_sourceclient-live_cfg::path, serviceName, AlCaHLTBitMon_QueryRunRegistry::string, and cond::throwException().
|
private |
Definition at line 641 of file CredentialStore.cc.
References cond::PrincipalData::adminKey, AUTHENTICATION_TABLE(), AUTHORIZATION_TABLE(), cond::auth::Cipher::b64decrypt(), C_ID_COL(), cond::auth::COND_ADMIN_ROLE, CONNECTION_ID_COL(), CONNECTION_KEY_COL(), CONNECTION_LABEL_COL(), CREDENTIAL_TABLE(), newFWLiteAna::found, cond::PrincipalData::id, P_ID_COL(), PASSWORD_COL(), cond::PrincipalData::principalKey, contentValuesFiles::query, ROLE_COL(), SCHEMA_COL(), cond::selectPrincipal(), AlCaHLTBitMon_QueryRunRegistry::string, cond::persistency::throwException(), tname(), USERNAME_COL(), VERIFICATION_KEY_COL(), and cond::PrincipalData::verifKey.
|
private |
Definition at line 633 of file CredentialStore.cc.
size_t cond::CredentialStore::unsetPermission | ( | const std::string & | principal, |
const std::string & | role, | ||
const std::string & | connectionString | ||
) |
Definition at line 1092 of file CredentialStore.cc.
References AUTHORIZATION_TABLE(), cond::CSScopedSession::close(), autoCondModifiers::connectionString, newFWLiteAna::found, cond::getAuthorizationEntries(), cond::PrincipalData::id, mps_check::msg, P_ID_COL(), ROLE_COL(), cond::auth::ROLES, SCHEMA_COL(), cond::selectPrincipal(), run_AlCaRecoTriggerBitsUpdateWorkflow::session, cond::CSScopedSession::start(), AlCaHLTBitMon_QueryRunRegistry::string, cond::throwException(), and tname().
bool cond::CredentialStore::updateConnection | ( | const std::string & | connectionLabel, |
const std::string & | userName, | ||
const std::string & | password | ||
) |
Definition at line 1144 of file CredentialStore.cc.
References cond::CSScopedSession::close(), run_AlCaRecoTriggerBitsUpdateWorkflow::session, cond::CSScopedSession::start(), AlCaHLTBitMon_QueryRunRegistry::string, to_lower(), and cond::updateConnectionData().
bool cond::CredentialStore::updatePrincipal | ( | const std::string & | principal, |
const std::string & | principalKey, | ||
bool | setAdmin = false |
||
) |
Definition at line 1014 of file CredentialStore.cc.
References cond::auth::Cipher::b64decrypt(), cond::CSScopedSession::close(), cond::auth::COND_ADMIN_ROLE, cond::CredentialData::connectionKey, cond::CredentialData::id, cmsHarvester::permissions, runTheMatrix::ret, cond::selectConnection(), run_AlCaRecoTriggerBitsUpdateWorkflow::session, cond::setPermissionData(), cond::CSScopedSession::start(), AlCaHLTBitMon_QueryRunRegistry::string, cond::throwException(), and cond::updatePrincipalData().
|
friend |
Definition at line 158 of file CredentialStore.h.
|
static |
Definition at line 88 of file CredentialStore.h.
|
private |
Definition at line 178 of file CredentialStore.h.
|
private |
Definition at line 175 of file CredentialStore.h.
|
private |
Definition at line 186 of file CredentialStore.h.
|
private |
Definition at line 188 of file CredentialStore.h.
|
private |
Definition at line 179 of file CredentialStore.h.
|
private |
Definition at line 181 of file CredentialStore.h.
|
private |
Definition at line 184 of file CredentialStore.h.
|
private |
Definition at line 183 of file CredentialStore.h.
|
private |
Definition at line 176 of file CredentialStore.h.