6 #include "CoralBase/AttributeList.h"
7 #include "CoralBase/Attribute.h"
8 #include "CoralKernel/Context.h"
9 #include "CoralCommon/URIParser.h"
10 #include "RelationalAccess/AuthenticationCredentials.h"
11 #include "RelationalAccess/IBulkOperation.h"
12 #include "RelationalAccess/IConnection.h"
13 #include "RelationalAccess/ISession.h"
14 #include "RelationalAccess/IRelationalService.h"
15 #include "RelationalAccess/IRelationalDomain.h"
16 #include "RelationalAccess/ITransaction.h"
17 #include "RelationalAccess/ISchema.h"
18 #include "RelationalAccess/ITable.h"
19 #include "RelationalAccess/TableDescription.h"
20 #include "RelationalAccess/ITableDataEditor.h"
21 #include "RelationalAccess/IQuery.h"
22 #include "RelationalAccess/ICursor.h"
24 #include "RelationalAccess/AuthenticationCredentials.h"
28 #include <boost/filesystem.hpp>
41 for ( std::map< std::pair<std::string,std::string>, coral::AuthenticationCredentials* >::iterator iData = m_data.begin();
42 iData != m_data.end(); ++iData )
58 std::pair<std::string,std::string> connKey( connectionString, role );
59 std::map< std::pair<std::string,std::string>, coral::AuthenticationCredentials* >::iterator iData = m_data.find( connKey );
60 if( iData == m_data.end() ){
61 iData = m_data.insert( std::make_pair( connKey,
new coral::AuthenticationCredentials(
serviceName ) ) ).first;
63 iData = m_data.insert( std::make_pair( connKey,
new coral::AuthenticationCredentials(
serviceName ) ) ).first;
64 iData->second->registerItem( itemName, itemValue );
79 std::pair<std::string,std::string> connKey( connectionString, role );
80 std::map< std::pair<std::string,std::string>, coral::AuthenticationCredentials* >::iterator iData = m_data.find( connKey );
81 if( iData != m_data.end() ){
83 m_data.erase( connKey );
85 iData = m_data.insert( std::make_pair( connKey,
new coral::AuthenticationCredentials(
serviceName ) ) ).first;
86 iData->second->registerItem( coral::IAuthenticationCredentials::userItem(), userName );
87 iData->second->registerItem( coral::IAuthenticationCredentials::passwordItem(), password );
91 for ( std::map< std::pair<std::string,std::string>, coral::AuthenticationCredentials* >::const_iterator iData = data.
m_data.begin();
92 iData != data.
m_data.end(); ++iData ){
93 registerCredentials( iData->first.first, iData->first.second, iData->second->valueForItem( coral::IAuthenticationCredentials::userItem() ),
94 iData->second->valueForItem( coral::IAuthenticationCredentials::passwordItem() ) );
98 const coral::IAuthenticationCredentials*
104 const coral::IAuthenticationCredentials*
107 const coral::IAuthenticationCredentials*
ret = 0;
108 std::pair<std::string,std::string> connKey( connectionString, role );
109 std::map< std::pair<std::string,std::string>, coral::AuthenticationCredentials* >::const_iterator iData = m_data.find( connKey );
110 if ( iData != m_data.end() ){
167 if( !serviceName.empty() ){
174 parser.setURI( connectionString );
176 std::string schemaName = parser.databaseOrSchemaName();
185 m_store.closeSession(
false );
188 m_store.startSuperSession( connectionString, userName, password );
191 m_store.startSession( readOnly );
194 m_store.closeSession();
215 coral::AttributeList readBuff;
220 coral::AttributeList whereData;
224 query->defineOutput(readBuff);
229 query->setCondition( whereClause, whereData );
230 coral::ICursor& cursor =
query->execute();
232 if ( cursor.next() ) {
234 const coral::AttributeList& row = cursor.currentRow();
260 coral::AttributeList readBuff;
266 coral::AttributeList whereData;
270 query->defineOutput(readBuff);
276 query->setCondition( whereClause, whereData );
277 coral::ICursor& cursor =
query->execute();
279 if ( cursor.next() ) {
280 const coral::AttributeList& row = cursor.currentRow();
303 coral::AttributeList readBuff;
307 coral::AttributeList whereData;
311 whereData[
P_ID_COL ].data<
int>() = principalId;
314 std::stringstream whereClause;
318 query->defineOutput(readBuff);
322 query->setCondition( whereClause.str(), whereData );
323 coral::ICursor& cursor =
query->execute();
325 if ( cursor.next() ) {
326 const coral::AttributeList& row = cursor.currentRow();
339 if( m_session.get() ){
340 if(m_session->transaction().isActive()){
342 m_session->transaction().commit();
344 m_session->transaction().rollback();
347 m_session->endUserSession();
350 if( m_connection.get() ){
351 m_connection->disconnect();
353 m_connection.reset();
359 query->limitReturnedRows( 1, 0 );
362 query->setForUpdate();
364 coral::AttributeList rowData;
366 rowData.begin()->data<
std::string >() = sequenceName;
367 query->setCondition( whereClause, rowData );
368 coral::ICursor& cursor =
query->execute();
369 if ( cursor.next() ) {
370 value = cursor.currentRow().begin()->data<
int>()+1;
376 coral::AttributeList updateData;
381 coral::AttributeList::iterator iAttribute = updateData.begin();
384 iAttribute->data<
int >() = value;
385 schema.tableHandle(
SEQUENCE_TABLE_NAME ).dataEditor().updateRows( setClause,whClause,updateData );
391 coral::ISchema&
schema = m_session->nominalSchema();
394 int principalId = -1;
400 coral::AttributeList authData;
401 editor0.rowBuffer(authData);
407 editor0.insertRow( authData );
412 coral::IHandle<coral::IRelationalService> relationalService =
coral::Context::instance().query<coral::IRelationalService>();
413 if ( ! relationalService.isValid() ){
417 coral::IRelationalDomain& domain = relationalService->domainForConnection( connectionString );
418 std::pair<std::string,std::string> connTokens = domain.decodeUserConnectionString( connectionString );
419 m_connection.reset( domain.newConnection( connTokens.first ) );
420 m_connection->connect();
425 coral::AccessMode accessMode = coral::ReadOnly;
426 if( !readMode ) accessMode = coral::Update;
427 m_session.reset( m_connection->newSession( schemaName, accessMode) );
428 m_session->startUserSession( userName, password );
430 m_session->transaction().start( readMode );
434 std::pair<std::string,std::string> connTokens = openConnection( connectionString );
435 openSession( connTokens.second, userName, password,
false );
441 throwException(
"The credential store has not been initialized.",
"cond::CredentialStore::openConnection" );
443 const std::string& storeConnectionString = m_serviceData->connectionString;
445 std::pair<std::string,std::string> connTokens = openConnection( storeConnectionString );
447 const std::string& userName = m_serviceData->userName;
448 const std::string& password = m_serviceData->password;
450 openSession( connTokens.second, userName, password,
true );
452 coral::ISchema&
schema = m_session->nominalSchema();
456 throwException(
"Credential database does not exists in \""+storeConnectionString+
"\"",
"CredentialStore::startSession");
459 const std::string& principalName = m_key.principalName();
462 if( !
selectPrincipal( m_session->nominalSchema(), principalName, princData ) ){
464 "CredentialStore::openSession");
468 if( verifStr != principalName ){
470 "CredentialStore::openSession");
473 m_principalId = princData.
id;
474 m_principalKey = cipher0.b64decrypt( princData.
principalKey );
480 if( adminKey != m_principalKey ){
482 throwException(
"Provided credentials does not allow admin operation.",
483 "CredentialStore::openSession");
487 std::auto_ptr<coral::IQuery>
query(schema.newQuery());
490 coral::AttributeList readBuff;
496 coral::AttributeList whereData;
500 whereData[
P_ID_COL ].data<
int>() = m_principalId;
503 std::stringstream whereClause;
508 query->defineOutput(readBuff);
514 query->setCondition( whereClause.str(), whereData );
515 coral::ICursor& cursor =
query->execute();
519 if ( cursor.next() ) {
520 const coral::AttributeList& row = cursor.currentRow();
528 if( cipher1.
b64decrypt( verificationKey ) != connLabel ){
529 throwException(
"Could not decrypt credentials.Provided key is invalid.",
530 "CredentialStore::startSession");
532 writeUserName = cipher1.
b64decrypt( encryptedUserName );
533 writePassword = cipher1.
b64decrypt( encryptedPassword );
537 throwException(
"Provided credentials are invalid for write access.",
538 "CredentialStore::openSession");
540 m_session->transaction().commit();
541 m_session->endUserSession();
542 openSession( connTokens.second, writeUserName, writePassword,
false );
548 coral::ISchema&
schema = m_session->nominalSchema();
557 coral::AttributeList updateData;
562 updateData[
C_ID_COL ].data<
int>() = connectionId;
566 editor.updateRows( setCl,whereCl, updateData );
572 coral::AttributeList insertData;
580 insertData[
P_ID_COL ].data<
int>() = principalId;
584 insertData[
C_ID_COL ].data<
int>() = connectionId;
585 editor.insertRow( insertData );
594 coral::ISchema&
schema = m_session->nominalSchema();
597 int connId = credsData.
id;
607 if( verificationKey != connectionLabel ){
608 throwException(
"Decoding of connection key failed.",
"CredentialStore::updateConnection");
614 coral::AttributeList updateData;
621 std::stringstream setCl;
625 editor.updateRows( setCl.str(),whereCl, updateData );
640 coral::AttributeList insertData;
653 editor.insertRow( insertData );
677 return std::make_pair( connId, connectionKey );
696 if( serviceName.empty() ){
697 throwException(
"Service name has not been provided.",
"cond::CredentialStore::setUpConnection" );
699 m_serviceName.clear();
702 if( authPath.empty() ){
703 throwException(
"The authentication Path has not been provided.",
"cond::CredentialStore::setUpForService" );
706 if(!boost::filesystem::exists(authPath) || !boost::filesystem::is_directory( authPath )){
707 throwException(
"Authentication Path is invalid.",
"cond::CredentialStore::setUpForService" );
714 std::map< std::string, auth::ServiceCredentials >::const_iterator iK = m_key.services().find( serviceName );
715 if( iK == m_key.services().end() ){
717 msg +=
"Service \""+serviceName+
"\" can't be open with the current key.";
721 m_serviceData = &iK->second;
722 return m_serviceData->connectionString;
728 coral::IHandle<coral::IRelationalService> relationalService =
coral::Context::instance().query<coral::IRelationalService>();
729 if ( ! relationalService.isValid() ){
733 coral::IRelationalDomain& domain = relationalService->domainForConnection( connectionString );
734 std::pair<std::string,std::string> connTokens = domain.decodeUserConnectionString( connectionString );
736 return setUpForService( serviceName, authPath );
741 coral::AttributeList insertData;
744 coral::AttributeList::iterator iAttribute = insertData.begin();
747 iAttribute->data<
int >() = -1;
754 session.
startSuper( connectionString, userName, password );
756 coral::ISchema&
schema = m_session->nominalSchema();
758 throwException(
"Credential database, already exists.",
"CredentialStore::create");
761 coral::TableDescription dseq;
764 dseq.insertColumn(
SEQUENCE_NAME_COL, coral::AttributeSpecification::typeNameForType<std::string>() );
766 dseq.insertColumn(
SEQUENCE_VALUE_COL,coral::AttributeSpecification::typeNameForType<int>() );
769 schema.createTable( dseq );
771 int columnSize = 2000;
776 coral::TableDescription descr0;
778 descr0.insertColumn(
PRINCIPAL_ID_COL, coral::AttributeSpecification::typeNameForType<int>());
779 descr0.insertColumn(
PRINCIPAL_NAME_COL, coral::AttributeSpecification::typeNameForType<std::string>(),columnSize,
false);
780 descr0.insertColumn(
VERIFICATION_COL, coral::AttributeSpecification::typeNameForType<std::string>(),columnSize,
false);
781 descr0.insertColumn(
PRINCIPAL_KEY_COL, coral::AttributeSpecification::typeNameForType<std::string>(),columnSize,
false);
782 descr0.insertColumn(
ADMIN_KEY_COL, coral::AttributeSpecification::typeNameForType<std::string>(),columnSize,
false);
788 std::vector<std::string> columnsUnique;
790 descr0.setUniqueConstraint( columnsUnique );
791 std::vector<std::string> columnsForIndex;
793 descr0.setPrimaryKey( columnsForIndex );
794 schema.createTable( descr0 );
798 coral::TableDescription descr1;
800 descr1.insertColumn(
AUTH_ID_COL, coral::AttributeSpecification::typeNameForType<int>());
801 descr1.insertColumn(
P_ID_COL, coral::AttributeSpecification::typeNameForType<int>());
802 descr1.insertColumn(
ROLE_COL, coral::AttributeSpecification::typeNameForType<std::string>(),columnSize,
false);
803 descr1.insertColumn(
SCHEMA_COL, coral::AttributeSpecification::typeNameForType<std::string>(),columnSize,
false);
804 descr1.insertColumn(
AUTH_KEY_COL, coral::AttributeSpecification::typeNameForType<std::string>(),columnSize,
false);
805 descr1.insertColumn(
C_ID_COL, coral::AttributeSpecification::typeNameForType<int>());
807 descr1.setNotNullConstraint(
P_ID_COL );
808 descr1.setNotNullConstraint(
ROLE_COL );
811 descr1.setNotNullConstraint(
C_ID_COL );
812 columnsUnique.clear();
816 descr1.setUniqueConstraint( columnsUnique );
817 columnsForIndex.clear();
819 descr1.setPrimaryKey( columnsForIndex );
820 schema.createTable( descr1 );
824 coral::TableDescription descr2;
826 descr2.insertColumn(
CONNECTION_ID_COL, coral::AttributeSpecification::typeNameForType<int>());
827 descr2.insertColumn(
CONNECTION_LABEL_COL, coral::AttributeSpecification::typeNameForType<std::string>(),columnSize,
false);
828 descr2.insertColumn(
USERNAME_COL, coral::AttributeSpecification::typeNameForType<std::string>(),columnSize,
false);
829 descr2.insertColumn(
PASSWORD_COL, coral::AttributeSpecification::typeNameForType<std::string>(),columnSize,
false);
830 descr2.insertColumn(
VERIFICATION_KEY_COL, coral::AttributeSpecification::typeNameForType<std::string>(),columnSize,
false);
831 descr2.insertColumn(
CONNECTION_KEY_COL, coral::AttributeSpecification::typeNameForType<std::string>(),columnSize,
false);
838 columnsUnique.clear();
840 descr2.setUniqueConstraint( columnsUnique );
841 columnsForIndex.clear();
843 descr2.setPrimaryKey( columnsForIndex );
844 schema.createTable( descr2 );
853 session.
startSuper( connectionString, userName, password );
855 coral::ISchema&
schema = m_session->nominalSchema();
866 throwException(
"The credential store has not been initialized.",
"cond::CredentialStore::installAdmin" );
869 const std::string& principalName = m_key.principalName();
872 session.
startSuper( connectionString, userName, password );
874 coral::ISchema&
schema = m_session->nominalSchema();
881 msg += principalName +
"\" has been installed already.";
890 int principalId = -1;
896 coral::AttributeList authData;
897 editor0.rowBuffer(authData);
903 editor0.insertRow( authData );
908 std::string encryptedConnectionKey = cipher1.b64encrypt( connectionKey );
919 coral::AttributeList connectionData;
920 editor1.rowBuffer(connectionData);
927 editor1.insertRow( connectionData );
933 coral::AttributeList permissionData;
934 editor2.rowBuffer(permissionData);
935 permissionData[
AUTH_ID_COL ].data<
int>() = authId;
936 permissionData[
P_ID_COL ].data<
int>() = principalId;
940 permissionData[
C_ID_COL ].data<
int>() = connId;
941 editor2.insertRow( permissionData );
951 session.
start(
false );
953 coral::ISchema&
schema = m_session->nominalSchema();
962 if( setAdmin ) principalKey = m_principalKey;
963 int principalId = princData.
id;
967 if( principalKey.empty() ) principalKey = adminCipher.
b64decrypt( princData.
adminKey );
968 coral::AttributeList updateData;
977 std::stringstream setClause;
982 editor.updateRows( setClause.str(),whereClause, updateData );
984 if( principalKey.empty() ) {
993 coral::AttributeList authData;
994 editor0.rowBuffer(authData);
1000 editor0.insertRow( authData );
1004 std::string connString = m_serviceData->connectionString;
1009 throwException(
"Credential Store connection has not been defined.",
"CredentialStore::updatePrincipal");
1024 session.
start(
false );
1026 coral::ISchema&
schema = m_session->nominalSchema();
1032 std::string msg =
"Principal \"" + principal +
"\" does not exist in the database.";
1040 std::string msg =
"Connection named \"" + connectionLabel +
"\" does not exist in the database.";
1054 session.
start(
false );
1055 coral::ISchema&
schema = m_session->nominalSchema();
1061 std::string msg =
"Principal \"" + principal +
"\" does not exist in the database.";
1066 coral::AttributeList deleteData;
1067 deleteData.extend<
int>(
P_ID_COL );
1070 deleteData[
P_ID_COL ].data<
int>() = princData.
id;
1073 std::stringstream whereClause;
1077 editor.deleteRows( whereClause.str(), deleteData );
1086 session.
start(
false );
1088 m_session->transaction().start();
1090 updateConnection( connectionLabel,userName, password,
true );
1098 session.
start(
false );
1099 coral::ISchema&
schema = m_session->nominalSchema();
1105 std::string msg =
"Principal \"" + principal +
"\" does not exist in the database.";
1111 coral::AttributeList deleteData0;
1112 deleteData0.extend<
int>(
P_ID_COL );
1113 deleteData0[
P_ID_COL ].data<
int>() = princData.
id;
1115 editor0.deleteRows( whereClause0 , deleteData0 );
1119 coral::AttributeList deleteData1;
1123 editor1.deleteRows( whereClause1 , deleteData1 );
1132 session.
start(
false );
1133 coral::ISchema&
schema = m_session->nominalSchema();
1139 std::string msg =
"Connection named \"" + connectionLabel +
"\" does not exist in the database.";
1145 coral::AttributeList deleteData0;
1146 deleteData0.extend<
int>(
C_ID_COL );
1147 deleteData0[
C_ID_COL ].data<
int>() = credsData.
id;
1149 editor0.deleteRows( whereClause0 , deleteData0 );
1153 coral::AttributeList deleteData1;
1157 editor1.deleteRows( whereClause1 , deleteData1 );
1166 session.
start(
true );
1167 coral::ISchema&
schema = m_session->nominalSchema();
1171 std::auto_ptr<coral::IQuery>
query(schema.newQuery());
1174 coral::AttributeList readBuff;
1182 coral::AttributeList whereData;
1184 whereData[
P_ID_COL ].data<
int>() = m_principalId;
1185 std::stringstream whereClause;
1188 query->defineOutput(readBuff);
1196 query->setCondition( whereClause.str(), whereData );
1197 coral::ICursor& cursor =
query->execute();
1198 while ( cursor.next() ) {
1199 const coral::AttributeList& row = cursor.currentRow();
1209 if( connCipher.
b64decrypt( encryptedLabel ) == connectionLabel ){
1219 bool forceUpdateConnection ){
1221 session.
start(
false );
1222 coral::ISchema&
schema = m_session->nominalSchema();
1228 std::string msg =
"Principal \"" + principal +
"\" does not exist in the database.";
1232 bool imported =
false;
1236 const std::map< std::pair<std::string,std::string>, coral::AuthenticationCredentials* >& creds = dataSource.
data();
1237 for( std::map< std::pair<std::string,std::string>, coral::AuthenticationCredentials* >::const_iterator iConn = creds.begin(); iConn != creds.end(); ++iConn ){
1240 parser.setURI( connectionString );
1243 std::string userName = iConn->second->valueForItem( coral::IAuthenticationCredentials::userItem() );
1244 std::string password = iConn->second->valueForItem( coral::IAuthenticationCredentials::passwordItem());
1246 std::pair<int,std::string> conn = updateConnection(
schemaLabel( serviceName, userName ), userName, password, forceUpdateConnection );
1249 setPermission( princData.
id, princKey, role, connectionString, conn.first, conn.second );
1259 session.
start(
true );
1260 coral::ISchema&
schema = m_session->nominalSchema();
1263 coral::AttributeList readBuff;
1265 query->defineOutput(readBuff);
1267 coral::ICursor& cursor =
query->execute();
1269 while ( cursor.next() ) {
1271 const coral::AttributeList& row = cursor.currentRow();
1281 session.
start(
true );
1282 coral::ISchema&
schema = m_session->nominalSchema();
1285 coral::AttributeList readBuff;
1291 query->defineOutput(readBuff);
1297 coral::ICursor& cursor =
query->execute();
1300 while ( cursor.next() ) {
1303 const coral::AttributeList& row = cursor.currentRow();
1310 if( verif == connLabel ){
1313 userName = cipher1.
b64decrypt( encryptedUserName );
1314 password = cipher1.
b64decrypt( encryptedPassword );
1316 destination.insert( std::make_pair( connLabel, std::make_pair( userName, password ) ) );
1328 session.
start(
true );
1329 coral::ISchema&
schema = m_session->nominalSchema();
1330 std::auto_ptr<coral::IQuery>
query(schema.newQuery());
1334 coral::AttributeList readBuff;
1339 coral::AttributeList whereData;
1340 std::stringstream whereClause;
1343 if( !principalName.empty() ){
1348 if( !role.empty() ){
1353 if( !connectionString.empty() ){
1359 query->defineOutput(readBuff);
1364 query->setCondition( whereClause.str(), whereData );
1368 coral::ICursor& cursor =
query->execute();
1370 while ( cursor.next() ) {
1371 const coral::AttributeList& row = cursor.currentRow();
1372 destination.resize( destination.size()+1 );
1386 session.
start(
true );
1387 coral::ISchema&
schema = m_session->nominalSchema();
1388 std::auto_ptr<coral::IQuery>
query(schema.newQuery());
1391 coral::AttributeList readBuff;
1399 coral::AttributeList whereData;
1400 std::stringstream whereClause;
1403 query->defineOutput(readBuff);
1411 query->setCondition( whereClause.str(), whereData );
1412 coral::ICursor& cursor =
query->execute();
1415 while ( cursor.next() ) {
1416 const coral::AttributeList& row = cursor.currentRow();
1427 if( verifKey == connectionLabel ){
1430 userName = cipher1.
b64decrypt( encryptedUserName );
1431 password = cipher1.
b64decrypt( encryptedPassword );
1441 return m_key.principalName();
CSScopedSession(CredentialStore &store)
const std::string & keyPrincipalName()
tuple ret
prodAgent to be discontinued
std::map< std::pair< std::string, std::string >, coral::AuthenticationCredentials * > m_data
credentials for the specific roles
void import(const AuthenticationCredentialSet &data)
static const std::string SEQUENCE_VALUE_COL("VALUE")
bool updatePrincipal(const std::string &principal, const std::string &principalKey, bool setAdmin=false)
CredentialStore()
Standard Constructor.
static const std::string ROLE_COL("C_ROLE")
virtual ~AuthenticationCredentialSet()
Destructor.
static PFTauRenderPlugin instance
bool removeConnection(const std::string &connectionLabel)
void openSession(const std::string &schemaName, const std::string &userName, const std::string &password, bool readMode)
static const std::string SCHEMA_COL("C_SCHEMA")
AuthenticationCredentialSet()
Constructor.
bool listConnections(std::map< std::string, std::pair< std::string, std::string > > &destination)
bool getNextSequenceValue(coral::ISchema &schema, const std::string &sequenceName, int &value)
void start(bool readOnly=true)
static const std::string COND_AUTHENTICATION_TABLE("COND_AUTHENTICATION")
static const std::string SEQUENCE_TABLE_NAME("COND_CREDENTIAL_SEQUENCE")
static const std::string COND_AUTHORIZATION_TABLE("COND_AUTHORIZATION")
void startSuper(const std::string &connectionString, const std::string &userName, const std::string &password)
static const std::string serviceName
CredentialStore & m_store
void throwException(const std::string &message, const std::string &methodName)
static const std::string PASSWORD_COL("CRED5")
std::string principalName
static const std::string COND_CREDENTIAL_TABLE("COND_CREDENTIAL")
void closeSession(bool commit=true)
static const std::string CONNECTION_KEY_COL("CRED7")
def gen
run2 Cosmic #### Run 256259 @ 0T 2015C### Run 272133 @ 3.8T 2016B###
void registerItem(const std::string &connectionString, const std::string &itemName, const std::string &itemValue)
std::string connectionString
const std::map< std::pair< std::string, std::string >, coral::AuthenticationCredentials * > & data() const
static const std::string ADMIN_KEY_COL("CRED2")
std::string connectionKey
static const std::string VERIFICATION_KEY_COL("CRED6")
void startSession(bool readMode)
bool updateConnection(const std::string &connectionLabel, const std::string &userName, const std::string &password)
bool createSchema(const std::string &connectionString, const std::string &userName, const std::string &password)
static constexpr const char *const COND_ADMIN_ROLE
bool exportAll(coral_bridge::AuthenticationCredentialSet &data)
std::string schemaLabel(const std::string &serviceName, const std::string &userName)
static constexpr unsigned int COND_DB_KEY_SIZE
bool listPrincipals(std::vector< std::string > &destination)
bool selectConnection(coral::ISchema &schema, const std::string &connectionLabel, CredentialData &destination)
std::string setUpForConnectionString(const std::string &connectionString, const std::string &authPath)
static const std::string VERIFICATION_COL("CRED0")
static const std::string SEQUENCE_NAME_COL("NAME")
int addUser(const std::string &principalName, const std::string &authenticationKey, const std::string &principalKey, const std::string &adminKey)
std::string setUpForService(const std::string &serviceName, const std::string &authPath)
Sets the initialization parameters.
bool importForPrincipal(const std::string &principal, const coral_bridge::AuthenticationCredentialSet &data, bool forceUpdateConnection=false)
import data
static const std::string USERNAME_COL("CRED4")
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
bool selectPrincipal(coral::ISchema &schema, const std::string &principal, PrincipalData &destination)
bool setPermission(const std::string &principal, const std::string &role, const std::string &connectionString, const std::string &connectionLabel)
virtual ~CredentialStore()
Standard Destructor.
std::string schemaLabelForCredentialStore(const std::string &connectionString)
bool selectForUser(coral_bridge::AuthenticationCredentialSet &destinationData)
static const std::string CONNECTION_ID_COL("CONN_ID")
bool selectAuthorization(coral::ISchema &schema, int principalId, const std::string &role, const std::string &connectionString, AuthorizationData &destination)
bool removePrincipal(const std::string &principal)
void startSuperSession(const std::string &connectionString, const std::string &userName, const std::string &password)
static const std::string PRINCIPAL_ID_COL("P_ID")
bool installAdmin(const std::string &userName, const std::string &password)
std::string make(size_t keySize)
bool selectPermissions(const std::string &principalName, const std::string &role, const std::string &connectionString, std::vector< Permission > &destination)
std::string b64encrypt(const std::string &input)
static const std::string AUTH_ID_COL("AUTH_ID")
void registerCredentials(const std::string &connectionString, const std::string &userName, const std::string &password)
const std::string DEFAULT_DATA_SOURCE("Cond_Default_Authentication")
std::pair< std::string, std::string > openConnection(const std::string &connectionString)
char data[epos_bytes_allocation]
const coral::IAuthenticationCredentials * get(const std::string &connectionString) const
void addSequence(coral::ISchema &schema, const std::string &name)
bool drop(const std::string &connectionString, const std::string &userName, const std::string &password)
static const std::string PRINCIPAL_KEY_COL("CRED1")
std::string verificationKey
std::string connectionLabel
static const std::string P_ID_COL("P_ID")
static constexpr const char *const FILE_PATH
static const std::string CONNECTION_LABEL_COL("CONN_LABEL")
void reset(double vett[256])
void throwException(const std::string &message, const std::string &methodName)
bool unsetPermission(const std::string &principal, const std::string &role, const std::string &connectionString)
static const std::string C_ID_COL("C_ID")
static constexpr const char *const COND_KEY
std::string b64decrypt(const std::string &input)
static const std::string AUTH_KEY_COL("CRED3")
static constexpr const char *const COND_DEFAULT_ROLE
static const std::string PRINCIPAL_NAME_COL("P_NAME")