7 #include "CoralBase/AttributeList.h"
8 #include "CoralBase/Attribute.h"
9 #include "CoralBase/MessageStream.h"
10 #include "CoralKernel/Context.h"
11 #include "CoralCommon/URIParser.h"
12 #include "RelationalAccess/AuthenticationCredentials.h"
13 #include "RelationalAccess/IBulkOperation.h"
14 #include "RelationalAccess/IConnection.h"
15 #include "RelationalAccess/ISession.h"
16 #include "RelationalAccess/IRelationalService.h"
17 #include "RelationalAccess/IRelationalDomain.h"
18 #include "RelationalAccess/ITransaction.h"
19 #include "RelationalAccess/ISchema.h"
20 #include "RelationalAccess/ITable.h"
21 #include "RelationalAccess/TableDescription.h"
22 #include "RelationalAccess/ITableDataEditor.h"
23 #include "RelationalAccess/IQuery.h"
24 #include "RelationalAccess/ICursor.h"
26 #include "RelationalAccess/AuthenticationCredentials.h"
30 #include <boost/filesystem.hpp>
43 for (
std::map< std::pair<std::string,std::string>, coral::AuthenticationCredentials* >::iterator iData = m_data.begin();
44 iData != m_data.end(); ++iData )
60 std::pair<std::string,std::string> connKey( connectionString, role );
61 std::map< std::pair<std::string,std::string>, coral::AuthenticationCredentials* >::iterator iData = m_data.find( connKey );
62 if( iData == m_data.end() ){
63 iData = m_data.insert( std::make_pair( connKey,
new coral::AuthenticationCredentials(
serviceName ) ) ).first;
65 iData = m_data.insert( std::make_pair( connKey,
new coral::AuthenticationCredentials(
serviceName ) ) ).first;
66 iData->second->registerItem( itemName, itemValue );
81 std::pair<std::string,std::string> connKey( connectionString, role );
82 std::map< std::pair<std::string,std::string>, coral::AuthenticationCredentials* >::iterator iData = m_data.find( connKey );
83 if( iData != m_data.end() ){
85 m_data.erase( connKey );
87 iData = m_data.insert( std::make_pair( connKey,
new coral::AuthenticationCredentials(
serviceName ) ) ).first;
88 iData->second->registerItem( coral::IAuthenticationCredentials::userItem(), userName );
89 iData->second->registerItem( coral::IAuthenticationCredentials::passwordItem(), password );
93 for (
std::map< std::pair<std::string,std::string>, coral::AuthenticationCredentials* >::const_iterator iData = data.
m_data.begin();
94 iData != data.
m_data.end(); ++iData ){
95 registerCredentials( iData->first.first, iData->first.second, iData->second->valueForItem( coral::IAuthenticationCredentials::userItem() ),
96 iData->second->valueForItem( coral::IAuthenticationCredentials::passwordItem() ) );
100 const coral::IAuthenticationCredentials*
106 const coral::IAuthenticationCredentials*
109 const coral::IAuthenticationCredentials*
ret = 0;
110 std::pair<std::string,std::string> connKey( connectionString, role );
111 std::map< std::pair<std::string,std::string>, coral::AuthenticationCredentials* >::const_iterator iData = m_data.find( connKey );
112 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();
358 coral::ISchema&
schema = m_session->nominalSchema();
364 Cipher cipher0( authenticationKey );
365 Cipher cipher1( adminKey );
367 coral::AttributeList authData;
368 editor0.rowBuffer(authData);
374 editor0.insertRow( authData );
379 coral::IHandle<coral::IRelationalService> relationalService =
coral::Context::instance().query<coral::IRelationalService>();
380 if ( ! relationalService.isValid() ){
384 coral::IRelationalDomain& domain = relationalService->domainForConnection( connectionString );
385 std::pair<std::string,std::string> connTokens = domain.decodeUserConnectionString( connectionString );
386 m_connection.reset( domain.newConnection( connTokens.first ) );
387 m_connection->connect();
392 coral::AccessMode accessMode = coral::ReadOnly;
393 if( !readMode ) accessMode = coral::Update;
394 m_session.reset( m_connection->newSession( schemaName, accessMode) );
395 m_session->startUserSession( userName, password );
397 m_session->transaction().start( readMode );
401 std::pair<std::string,std::string> connTokens = openConnection( connectionString );
402 openSession( connTokens.second, userName, password,
false );
408 throwException(
"The credential store has not been initialized.",
"cond::CredentialStore::openConnection" );
410 const std::string& storeConnectionString = m_serviceData->connectionString;
412 std::pair<std::string,std::string> connTokens = openConnection( storeConnectionString );
414 const std::string& userName = m_serviceData->userName;
415 const std::string& password = m_serviceData->password;
417 openSession( connTokens.second, userName, password,
true );
419 coral::ISchema&
schema = m_session->nominalSchema();
423 throwException(
"Credential database does not exists in \""+storeConnectionString+
"\"",
"CredentialStore::startSession");
426 const std::string& principalName = m_key.principalName();
429 if( !
selectPrincipal( m_session->nominalSchema(), principalName, princData ) ){
431 "CredentialStore::openSession");
433 Cipher cipher0( m_key.principalKey() );
435 if( verifStr != principalName ){
437 "CredentialStore::openSession");
440 m_principalId = princData.
id;
441 m_principalKey = cipher0.b64decrypt( princData.
principalKey );
445 Cipher cipher0( m_principalKey );
447 if( adminKey != m_principalKey ){
449 throwException(
"Provided credentials does not allow admin operation.",
450 "CredentialStore::openSession");
454 std::auto_ptr<coral::IQuery>
query(schema.newQuery());
457 coral::AttributeList readBuff;
463 coral::AttributeList whereData;
467 whereData[
P_ID_COL ].data<
int>() = m_principalId;
470 std::stringstream whereClause;
475 query->defineOutput(readBuff);
481 query->setCondition( whereClause.str(), whereData );
482 coral::ICursor& cursor =
query->execute();
486 if ( cursor.next() ) {
487 const coral::AttributeList& row = cursor.currentRow();
491 Cipher cipher1( connectionKey );
495 if( cipher1.
b64decrypt( verificationKey ) != connLabel ){
496 throwException(
"Could not decrypt credentials.Provided key is invalid.",
497 "CredentialStore::startSession");
499 writeUserName = cipher1.
b64decrypt( encryptedUserName );
500 writePassword = cipher1.
b64decrypt( encryptedPassword );
504 throwException(
"Provided credentials are invalid for write access.",
505 "CredentialStore::openSession");
507 m_session->transaction().commit();
508 m_session->endUserSession();
509 openSession( connTokens.second, writeUserName, writePassword,
false );
515 coral::ISchema&
schema = m_session->nominalSchema();
516 Cipher cipher( principalKey );
524 coral::AttributeList updateData;
529 updateData[
C_ID_COL ].data<
int>() = connectionId;
533 editor.updateRows( setCl,whereCl, updateData );
539 coral::AttributeList insertData;
547 insertData[
P_ID_COL ].data<
int>() = principalId;
551 insertData[
C_ID_COL ].data<
int>() = connectionId;
552 editor.insertRow( insertData );
561 coral::ISchema&
schema = m_session->nominalSchema();
564 int connId = credsData.
id;
566 Cipher adminCipher( m_principalKey );
572 Cipher cipher( connectionKey );
574 if( verificationKey != connectionLabel ){
575 throwException(
"Decoding of connection key failed.",
"CredentialStore::updateConnection");
581 coral::AttributeList updateData;
588 std::stringstream setCl;
592 editor.updateRows( setCl.str(),whereCl, updateData );
599 connectionKey = gen.
make( Auth::COND_DB_KEY_SIZE );
600 Cipher cipher( connectionKey );
608 coral::AttributeList insertData;
621 editor.insertRow( insertData );
645 return std::make_pair( connId, connectionKey );
664 if( serviceName.empty() ){
665 throwException(
"Service name has not been provided.",
"cond::CredentialStore::setUpConnection" );
667 m_serviceName.clear();
670 if( authPath.empty() ){
671 throwException(
"The authentication Path has not been provided.",
"cond::CredentialStore::setUpForService" );
674 if(!boost::filesystem::exists(authPath) || !boost::filesystem::is_directory( authPath )){
675 throwException(
"Authentication Path is invalid.",
"cond::CredentialStore::setUpForService" );
682 std::map< std::string, ServiceCredentials >::const_iterator iK = m_key.services().find( serviceName );
683 if( iK == m_key.services().end() ){
685 msg +=
"Service \""+serviceName+
"\" can't be open with the current key.";
689 m_serviceData = &iK->second;
690 return m_serviceData->connectionString;
696 coral::IHandle<coral::IRelationalService> relationalService =
coral::Context::instance().query<coral::IRelationalService>();
697 if ( ! relationalService.isValid() ){
701 coral::IRelationalDomain& domain = relationalService->domainForConnection( connectionString );
702 std::pair<std::string,std::string> connTokens = domain.decodeUserConnectionString( connectionString );
704 return setUpForService( serviceName, authPath );
711 session.
startSuper( connectionString, userName, password );
713 coral::ISchema&
schema = m_session->nominalSchema();
715 throwException(
"Credential database, already exists.",
"CredentialStore::create");
718 int columnSize = 2000;
722 coral::TableDescription descr0;
724 descr0.insertColumn(
PRINCIPAL_ID_COL, coral::AttributeSpecification::typeNameForType<int>());
725 descr0.insertColumn(
PRINCIPAL_NAME_COL, coral::AttributeSpecification::typeNameForType<std::string>(),columnSize,
false);
726 descr0.insertColumn(
VERIFICATION_COL, coral::AttributeSpecification::typeNameForType<std::string>(),columnSize,
false);
727 descr0.insertColumn(
PRINCIPAL_KEY_COL, coral::AttributeSpecification::typeNameForType<std::string>(),columnSize,
false);
728 descr0.insertColumn(
ADMIN_KEY_COL, coral::AttributeSpecification::typeNameForType<std::string>(),columnSize,
false);
734 std::vector<std::string> columnsUnique;
736 descr0.setUniqueConstraint( columnsUnique );
737 std::vector<std::string> columnsForIndex;
739 descr0.setPrimaryKey( columnsForIndex );
740 schema.createTable( descr0 );
744 coral::TableDescription descr1;
746 descr1.insertColumn(
AUTH_ID_COL, coral::AttributeSpecification::typeNameForType<int>());
747 descr1.insertColumn(
P_ID_COL, coral::AttributeSpecification::typeNameForType<int>());
748 descr1.insertColumn(
ROLE_COL, coral::AttributeSpecification::typeNameForType<std::string>(),columnSize,
false);
749 descr1.insertColumn(
SCHEMA_COL, coral::AttributeSpecification::typeNameForType<std::string>(),columnSize,
false);
750 descr1.insertColumn(
AUTH_KEY_COL, coral::AttributeSpecification::typeNameForType<std::string>(),columnSize,
false);
751 descr1.insertColumn(
C_ID_COL, coral::AttributeSpecification::typeNameForType<int>());
753 descr1.setNotNullConstraint(
P_ID_COL );
754 descr1.setNotNullConstraint(
ROLE_COL );
757 descr1.setNotNullConstraint(
C_ID_COL );
758 columnsUnique.clear();
762 descr1.setUniqueConstraint( columnsUnique );
763 columnsForIndex.clear();
765 descr1.setPrimaryKey( columnsForIndex );
766 schema.createTable( descr1 );
770 coral::TableDescription descr2;
772 descr2.insertColumn(
CONNECTION_ID_COL, coral::AttributeSpecification::typeNameForType<int>());
773 descr2.insertColumn(
CONNECTION_LABEL_COL, coral::AttributeSpecification::typeNameForType<std::string>(),columnSize,
false);
774 descr2.insertColumn(
USERNAME_COL, coral::AttributeSpecification::typeNameForType<std::string>(),columnSize,
false);
775 descr2.insertColumn(
PASSWORD_COL, coral::AttributeSpecification::typeNameForType<std::string>(),columnSize,
false);
776 descr2.insertColumn(
VERIFICATION_KEY_COL, coral::AttributeSpecification::typeNameForType<std::string>(),columnSize,
false);
777 descr2.insertColumn(
CONNECTION_KEY_COL, coral::AttributeSpecification::typeNameForType<std::string>(),columnSize,
false);
784 columnsUnique.clear();
786 descr2.setUniqueConstraint( columnsUnique );
787 columnsForIndex.clear();
789 descr2.setPrimaryKey( columnsForIndex );
790 schema.createTable( descr2 );
799 session.
startSuper( connectionString, userName, password );
801 coral::ISchema&
schema = m_session->nominalSchema();
812 throwException(
"The credential store has not been initialized.",
"cond::CredentialStore::installAdmin" );
814 const std::string& connectionString = m_serviceData->connectionString;
815 const std::string& principalName = m_key.principalName();
818 session.
startSuper( connectionString, userName, password );
820 coral::ISchema&
schema = m_session->nominalSchema();
827 msg += principalName +
"\" has been installed already.";
839 Cipher cipher0( m_key.principalKey() );
840 Cipher cipher1( m_principalKey );
842 coral::AttributeList authData;
843 editor0.rowBuffer(authData);
849 editor0.insertRow( authData );
854 std::string encryptedConnectionKey = cipher1.b64encrypt( connectionKey );
856 Cipher cipher2( connectionKey );
864 coral::AttributeList connectionData;
865 editor1.rowBuffer(connectionData);
872 editor1.insertRow( connectionData );
877 coral::AttributeList permissionData;
878 editor2.rowBuffer(permissionData);
879 permissionData[
AUTH_ID_COL ].data<
int>() = authId;
880 permissionData[
P_ID_COL ].data<
int>() = principalId;
884 permissionData[
C_ID_COL ].data<
int>() = connId;
885 editor2.insertRow( permissionData );
895 session.
start(
false );
897 coral::ISchema&
schema = m_session->nominalSchema();
902 Cipher adminCipher( m_principalKey );
903 Cipher cipher( authenticationKey );
906 if( setAdmin ) principalKey = m_principalKey;
907 int principalId = princData.
id;
911 if( principalKey.empty() ) principalKey = adminCipher.
b64decrypt( princData.
adminKey );
912 coral::AttributeList updateData;
921 std::stringstream setClause;
926 editor.updateRows( setClause.str(),whereClause, updateData );
928 if( principalKey.empty() ) {
938 coral::AttributeList authData;
939 editor0.rowBuffer(authData);
945 editor0.insertRow( authData );
949 std::string connString = m_serviceData->connectionString;
954 throwException(
"Credential Store connection has not been defined.",
"CredentialStore::updatePrincipal");
969 session.
start(
false );
971 coral::ISchema&
schema = m_session->nominalSchema();
977 std::string msg =
"Principal \"" + principal +
"\" does not exist in the database.";
985 std::string msg =
"Connection named \"" + connectionLabel +
"\" does not exist in the database.";
989 Cipher cipher( m_principalKey );
999 session.
start(
false );
1000 coral::ISchema&
schema = m_session->nominalSchema();
1006 std::string msg =
"Principal \"" + principal +
"\" does not exist in the database.";
1011 coral::AttributeList deleteData;
1012 deleteData.extend<
int>(
P_ID_COL );
1015 deleteData[
P_ID_COL ].data<
int>() = princData.
id;
1018 std::stringstream whereClause;
1022 editor.deleteRows( whereClause.str(), deleteData );
1031 session.
start(
false );
1033 m_session->transaction().start();
1035 updateConnection( connectionLabel,userName, password,
true );
1043 session.
start(
false );
1044 coral::ISchema&
schema = m_session->nominalSchema();
1050 std::string msg =
"Principal \"" + principal +
"\" does not exist in the database.";
1056 coral::AttributeList deleteData0;
1057 deleteData0.extend<
int>(
P_ID_COL );
1058 deleteData0[
P_ID_COL ].data<
int>() = princData.
id;
1060 editor0.deleteRows( whereClause0 , deleteData0 );
1064 coral::AttributeList deleteData1;
1068 editor1.deleteRows( whereClause1 , deleteData1 );
1077 session.
start(
false );
1078 coral::ISchema&
schema = m_session->nominalSchema();
1084 std::string msg =
"Connection named \"" + connectionLabel +
"\" does not exist in the database.";
1090 coral::AttributeList deleteData0;
1091 deleteData0.extend<
int>(
C_ID_COL );
1092 deleteData0[
C_ID_COL ].data<
int>() = credsData.
id;
1094 editor0.deleteRows( whereClause0 , deleteData0 );
1098 coral::AttributeList deleteData1;
1102 editor1.deleteRows( whereClause1 , deleteData1 );
1111 session.
start(
true );
1112 coral::ISchema&
schema = m_session->nominalSchema();
1114 Cipher cipher( m_principalKey );
1116 std::auto_ptr<coral::IQuery>
query(schema.newQuery());
1119 coral::AttributeList readBuff;
1127 coral::AttributeList whereData;
1129 whereData[
P_ID_COL ].data<
int>() = m_principalId;
1130 std::stringstream whereClause;
1133 query->defineOutput(readBuff);
1141 query->setCondition( whereClause.str(), whereData );
1142 coral::ICursor& cursor =
query->execute();
1143 while ( cursor.next() ) {
1144 const coral::AttributeList& row = cursor.currentRow();
1153 Cipher connCipher( authKey );
1154 if( connCipher.
b64decrypt( encryptedLabel ) == connectionLabel ){
1164 bool forceUpdateConnection ){
1166 session.
start(
false );
1167 coral::ISchema&
schema = m_session->nominalSchema();
1173 std::string msg =
"Principal \"" + principal +
"\" does not exist in the database.";
1177 bool imported =
false;
1178 Cipher cipher( m_principalKey );
1181 const std::map< std::pair<std::string,std::string>, coral::AuthenticationCredentials* >& creds = dataSource.
data();
1182 for(
std::map< std::pair<std::string,std::string>, coral::AuthenticationCredentials* >::const_iterator iConn = creds.begin(); iConn != creds.end(); ++iConn ){
1183 const std::string& connectionString = iConn->first.first;
1185 parser.setURI( connectionString );
1188 std::string userName = iConn->second->valueForItem( coral::IAuthenticationCredentials::userItem() );
1189 std::string password = iConn->second->valueForItem( coral::IAuthenticationCredentials::passwordItem());
1191 std::pair<int,std::string>
conn = updateConnection(
schemaLabel( serviceName, userName ), userName, password, forceUpdateConnection );
1192 Cipher cipher( m_principalKey );
1194 setPermission( princData.
id, princKey, role, connectionString, conn.first, conn.second );
1204 session.
start(
true );
1205 coral::ISchema&
schema = m_session->nominalSchema();
1208 coral::AttributeList readBuff;
1210 query->defineOutput(readBuff);
1212 coral::ICursor& cursor =
query->execute();
1214 while ( cursor.next() ) {
1216 const coral::AttributeList& row = cursor.currentRow();
1226 session.
start(
true );
1227 coral::ISchema&
schema = m_session->nominalSchema();
1230 coral::AttributeList readBuff;
1236 query->defineOutput(readBuff);
1242 coral::ICursor& cursor =
query->execute();
1244 Cipher cipher0(m_principalKey );
1245 while ( cursor.next() ) {
1248 const coral::AttributeList& row = cursor.currentRow();
1253 Cipher cipher1( connKey );
1255 if( verif == connLabel ){
1258 userName = cipher1.
b64decrypt( encryptedUserName );
1259 password = cipher1.
b64decrypt( encryptedPassword );
1261 destination.insert( std::make_pair( connLabel, std::make_pair( userName, password ) ) );
1273 session.
start(
true );
1274 coral::ISchema&
schema = m_session->nominalSchema();
1275 std::auto_ptr<coral::IQuery>
query(schema.newQuery());
1279 coral::AttributeList readBuff;
1284 coral::AttributeList whereData;
1285 std::stringstream whereClause;
1288 if( !principalName.empty() ){
1293 if( !role.empty() ){
1298 if( !connectionString.empty() ){
1304 query->defineOutput(readBuff);
1309 query->setCondition( whereClause.str(), whereData );
1313 coral::ICursor& cursor =
query->execute();
1315 while ( cursor.next() ) {
1316 const coral::AttributeList& row = cursor.currentRow();
1317 destination.resize( destination.size()+1 );
1331 session.
start(
true );
1332 coral::ISchema&
schema = m_session->nominalSchema();
1333 std::auto_ptr<coral::IQuery>
query(schema.newQuery());
1336 coral::AttributeList readBuff;
1344 coral::AttributeList whereData;
1345 std::stringstream whereClause;
1348 query->defineOutput(readBuff);
1356 query->setCondition( whereClause.str(), whereData );
1357 coral::ICursor& cursor =
query->execute();
1359 Cipher cipher0( m_principalKey );
1360 while ( cursor.next() ) {
1361 const coral::AttributeList& row = cursor.currentRow();
1370 Cipher cipher1( connectionKey );
1372 if( verifKey == connectionLabel ){
1375 userName = cipher1.
b64decrypt( encryptedUserName );
1376 password = cipher1.
b64decrypt( encryptedPassword );
1386 return m_key.principalName();
static const std::string FILE_PATH
CSScopedSession(CredentialStore &store)
const std::string & keyPrincipalName()
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 COND_KEY
bool updatePrincipal(const std::string &principal, const std::string &principalKey, bool setAdmin=false)
static const std::string COND_ADMIN_ROLE
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)
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
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")
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
tuple path
else: Piece not in the list, fine.
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)
bool exportAll(coral_bridge::AuthenticationCredentialSet &data)
std::string schemaLabel(const std::string &serviceName, const std::string &userName)
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")
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")
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)
std::string b64encrypt(const std::string &input)
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)
int getNextId(const std::string &sequenceName, bool sinchronize=false)
void create(const std::string &sequenceName)
bool removePrincipal(const std::string &principal)
void startSuperSession(const std::string &connectionString, const std::string &userName, const std::string &password)
void throwException(std::string const &message, std::string const &methodName)
static const std::string PRINCIPAL_ID_COL("P_ID")
bool installAdmin(const std::string &userName, const std::string &password)
static const unsigned int COND_DB_KEY_SIZE
std::string b64decrypt(const std::string &input)
std::string make(size_t keySize)
bool selectPermissions(const std::string &principalName, const std::string &role, const std::string &connectionString, std::vector< Permission > &destination)
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
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
static const std::string COND_DEFAULT_ROLE
std::string connectionLabel
static const std::string P_ID_COL("P_ID")
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 const std::string AUTH_KEY_COL("CRED3")
static const std::string PRINCIPAL_NAME_COL("P_NAME")