CMS 3D CMS Logo

Classes | Namespaces | Functions | Variables
CredentialStore.cc File Reference
#include "CondCore/CondDB/interface/CredentialStore.h"
#include "CondCore/CondDB/interface/Cipher.h"
#include "CondCore/CondDB/interface/Exception.h"
#include "CondCore/CondDB/interface/Auth.h"
#include "CoralBase/AttributeList.h"
#include "CoralBase/Attribute.h"
#include "CoralKernel/Context.h"
#include "CoralCommon/URIParser.h"
#include "RelationalAccess/AuthenticationCredentials.h"
#include "RelationalAccess/IBulkOperation.h"
#include "RelationalAccess/IConnection.h"
#include "RelationalAccess/ISession.h"
#include "RelationalAccess/IRelationalService.h"
#include "RelationalAccess/IRelationalDomain.h"
#include "RelationalAccess/ITransaction.h"
#include "RelationalAccess/ISchema.h"
#include "RelationalAccess/ITable.h"
#include "RelationalAccess/TableDescription.h"
#include "RelationalAccess/ITableDataEditor.h"
#include "RelationalAccess/ITablePrivilegeManager.h"
#include "RelationalAccess/IQuery.h"
#include "RelationalAccess/ICursor.h"
#include <filesystem>
#include <fstream>
#include <sstream>

Go to the source code of this file.

Classes

struct  cond::AuthorizationData
 
struct  cond::CredentialData
 
class  cond::CSScopedSession
 
struct  cond::PrincipalData
 

Namespaces

 cond
 

Functions

void addSequence (const std::string &schemaVersion, coral::ISchema &schema, const std::string &name)
 
static const std::string ADMIN_KEY_COL ("CRED2")
 
static const std::string AUTH_ID_COL ("AUTH_ID")
 
static const std::string AUTH_KEY_COL ("CRED3")
 
static const std::string AUTHENTICATION_TABLE ("AUTHENTICATION")
 
static const std::string AUTHORIZATION_TABLE ("AUTHORIZATION")
 
static const std::string C_ID_COL ("C_ID")
 
static const std::string CONNECTION_ID_COL ("CONN_ID")
 
static const std::string CONNECTION_KEY_COL ("CRED7")
 
static const std::string CONNECTION_LABEL_COL ("CONN_LABEL")
 
static const std::string CREDENTIAL_TABLE ("CREDENTIAL")
 
const std::string DEFAULT_DATA_SOURCE ("Cond_Default_Authentication")
 
size_t cond::getAuthorizationEntries (const std::string &schemaVersion, coral::ISchema &schema, int principalId, const std::string &role, const std::string &connectionString)
 
bool cond::getNextSequenceValue (const std::string &schemaVersion, coral::ISchema &schema, const std::string &sequenceName, int &value)
 
static const std::string LEGACY_TABLE_PREFIX ("COND_")
 
static const std::string P_ID_COL ("P_ID")
 
static const std::string PASSWORD_COL ("CRED5")
 
static const std::string PRINCIPAL_ID_COL ("P_ID")
 
static const std::string PRINCIPAL_KEY_COL ("CRED1")
 
static const std::string PRINCIPAL_NAME_COL ("P_NAME")
 
static const std::string ROLE_COL ("C_ROLE")
 
static const std::string SCHEMA_COL ("C_SCHEMA")
 
std::string cond::schemaLabel (const std::string &serviceName, const std::string &userName)
 
std::string cond::schemaLabelForCredentialStore (const std::string &connectionString)
 
bool cond::selectAuthorization (const std::string &schemaVersion, coral::ISchema &schema, int principalId, const std::string &role, const std::string &connectionString, AuthorizationData &destination)
 
bool cond::selectConnection (const std::string &schemaVersion, coral::ISchema &schema, const std::string &connectionLabel, CredentialData &destination)
 
bool cond::selectPrincipal (const std::string &schemaVersion, coral::ISchema &schema, const std::string &principal, PrincipalData &destination)
 
static const std::string SEQUENCE_NAME_COL ("NAME")
 
static const std::string SEQUENCE_TABLE ("CREDENTIAL_SEQUENCE")
 
static const std::string SEQUENCE_VALUE_COL ("VALUE")
 
bool cond::setPermissionData (const std::string &schemaVersion, coral::ISchema &schema, int principalId, const std::string &principalKey, const std::string &role, const std::string &connectionString, int connectionId, const std::string &connectionKey, std::stringstream &log)
 
static const std::string TABLE_PREFIX ("DB_")
 
std::string tname (const std::string &tableName, const std::string &schemaVersion)
 
std::pair< int, std::string > cond::updateConnectionData (const std::string &schemaVersion, coral::ISchema &schema, const std::string &adminKey, const std::string &connectionLabel, const std::string &userName, const std::string &password, bool forceUpdate, std::stringstream &log)
 
std::pair< int, std::string > cond::updatePrincipalData (const std::string &schemaVersion, coral::ISchema &schema, const std::string &authenticationKey, const std::string &principalName, const std::string &adminKey, bool init, std::stringstream &log)
 
static const std::string USERNAME_COL ("CRED4")
 
static const std::string VERIFICATION_COL ("CRED0")
 
static const std::string VERIFICATION_KEY_COL ("CRED6")
 

Variables

static const std::string serviceName = "CondAuthenticationService"
 

Function Documentation

◆ addSequence()

void addSequence ( const std::string &  schemaVersion,
coral::ISchema &  schema,
const std::string &  name 
)

Definition at line 805 of file CredentialStore.cc.

References Skims_PA_cff::name, SEQUENCE_NAME_COL(), SEQUENCE_TABLE(), SEQUENCE_VALUE_COL(), AlCaHLTBitMon_QueryRunRegistry::string, and tname().

Referenced by cond::CredentialStore::createSchema().

805  {
806  // Create the entry in the table
807  coral::AttributeList insertData;
808  insertData.extend<std::string>(SEQUENCE_NAME_COL);
809  insertData.extend<int>(SEQUENCE_VALUE_COL);
810  coral::AttributeList::iterator iAttribute = insertData.begin();
811  iAttribute->data<std::string>() = name;
812  ++iAttribute;
813  iAttribute->data<int>() = -1;
814  schema.tableHandle(tname(SEQUENCE_TABLE, schemaVersion)).dataEditor().insertRow(insertData);
815 }
static const std::string SEQUENCE_VALUE_COL("VALUE")
static const std::string SEQUENCE_TABLE("CREDENTIAL_SEQUENCE")
static const std::string SEQUENCE_NAME_COL("NAME")
std::string tname(const std::string &tableName, const std::string &schemaVersion)

◆ ADMIN_KEY_COL()

static const std::string ADMIN_KEY_COL ( "CRED2"  )
static

◆ AUTH_ID_COL()

static const std::string AUTH_ID_COL ( "AUTH_ID"  )
static

◆ AUTH_KEY_COL()

static const std::string AUTH_KEY_COL ( "CRED3"  )
static

◆ AUTHENTICATION_TABLE()

static const std::string AUTHENTICATION_TABLE ( "AUTHENTICATION"  )
static

◆ AUTHORIZATION_TABLE()

static const std::string AUTHORIZATION_TABLE ( "AUTHORIZATION"  )
static

◆ C_ID_COL()

static const std::string C_ID_COL ( "C_ID"  )
static

◆ CONNECTION_ID_COL()

static const std::string CONNECTION_ID_COL ( "CONN_ID"  )
static

◆ CONNECTION_KEY_COL()

static const std::string CONNECTION_KEY_COL ( "CRED7"  )
static

◆ CONNECTION_LABEL_COL()

static const std::string CONNECTION_LABEL_COL ( "CONN_LABEL"  )
static

◆ CREDENTIAL_TABLE()

static const std::string CREDENTIAL_TABLE ( "CREDENTIAL"  )
static

◆ DEFAULT_DATA_SOURCE()

const std::string DEFAULT_DATA_SOURCE ( "Cond_Default_Authentication"  )

◆ LEGACY_TABLE_PREFIX()

static const std::string LEGACY_TABLE_PREFIX ( "COND_"  )
static

Referenced by tname().

◆ P_ID_COL()

static const std::string P_ID_COL ( "P_ID"  )
static

◆ PASSWORD_COL()

static const std::string PASSWORD_COL ( "CRED5"  )
static

◆ PRINCIPAL_ID_COL()

static const std::string PRINCIPAL_ID_COL ( "P_ID"  )
static

◆ PRINCIPAL_KEY_COL()

static const std::string PRINCIPAL_KEY_COL ( "CRED1"  )
static

◆ PRINCIPAL_NAME_COL()

static const std::string PRINCIPAL_NAME_COL ( "P_NAME"  )
static

◆ ROLE_COL()

static const std::string ROLE_COL ( "C_ROLE"  )
static

◆ SCHEMA_COL()

static const std::string SCHEMA_COL ( "C_SCHEMA"  )
static

◆ SEQUENCE_NAME_COL()

static const std::string SEQUENCE_NAME_COL ( "NAME"  )
static

◆ SEQUENCE_TABLE()

static const std::string SEQUENCE_TABLE ( "CREDENTIAL_SEQUENCE"  )
static

◆ SEQUENCE_VALUE_COL()

static const std::string SEQUENCE_VALUE_COL ( "VALUE"  )
static

◆ TABLE_PREFIX()

static const std::string TABLE_PREFIX ( "DB_"  )
static

Referenced by tname().

◆ tname()

std::string tname ( const std::string &  tableName,
const std::string &  schemaVersion 
)

Definition at line 150 of file CredentialStore.cc.

References LEGACY_TABLE_PREFIX(), hcallasereventfilter2012_cfi::prefix, AlCaHLTBitMon_QueryRunRegistry::string, TABLE_PREFIX(), and HLT_2024v13_cff::tableName.

Referenced by addSequence(), HIPAlignmentAlgorithm::bookRoot(), clangcms::EDMPluginDumper::checkASTDecl(), HLTBitComputer::compute(), cond::CredentialStore::createSchema(), MEGeom::drawHist(), cond::CredentialStore::drop(), cond::CredentialStore::exportAll(), MELaserPrim::fill(), SiPixelActionExecutor::fillFEDErrorSummary(), SiPixelActionExecutor::fillSummary(), cond::getAuthorizationEntries(), cond::getNextSequenceValue(), cond::CredentialStore::getUserCredentials(), HLTBitComputer::HLTBitComputer(), cond::persistency::O2O_RUN::Table::insert(), cond::CredentialStore::listConnections(), cond::CredentialStore::listPrincipals(), HLTPerformanceInfo::Module::operator==(), HLTPerformanceInfo::Path::operator==(), cond::CredentialStore::removeConnection(), cond::CredentialStore::removePrincipal(), cond::selectAuthorization(), cond::selectConnection(), cond::CredentialStore::selectForUser(), cond::CredentialStore::selectPermissions(), cond::selectPrincipal(), MELaserPrim::setInt(), cond::setPermissionData(), MELaserPrim::setVal(), cond::CredentialStore::startSession(), AlignmentIORootBase::testFile(), AlignmentIORootBase::treeName(), cond::CredentialStore::unsetPermission(), cond::updateConnectionData(), and cond::updatePrincipalData().

150  {
152  if (schemaVersion.empty())
154  return prefix + tableName;
155 }
static const std::string LEGACY_TABLE_PREFIX("COND_")
static const std::string TABLE_PREFIX("DB_")

◆ USERNAME_COL()

static const std::string USERNAME_COL ( "CRED4"  )
static

◆ VERIFICATION_COL()

static const std::string VERIFICATION_COL ( "CRED0"  )
static

◆ VERIFICATION_KEY_COL()

static const std::string VERIFICATION_KEY_COL ( "CRED6"  )
static

Variable Documentation

◆ serviceName

const std::string serviceName = "CondAuthenticationService"
static