CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
coral_bridge::AuthenticationCredentialSet Class Reference

#include <CredentialStore.h>

Public Member Functions

 AuthenticationCredentialSet ()
 Constructor. More...
 
const std::map< std::pair< std::string, std::string >, coral::AuthenticationCredentials * > & data () const
 
const coral::IAuthenticationCredentials * get (const std::string &connectionString) const
 
const coral::IAuthenticationCredentials * get (const std::string &connectionString, const std::string &role) const
 
void import (const AuthenticationCredentialSet &data)
 
void registerCredentials (const std::string &connectionString, const std::string &userName, const std::string &password)
 
void registerCredentials (const std::string &connectionString, const std::string &role, const std::string &userName, const std::string &password)
 
void registerItem (const std::string &connectionString, const std::string &itemName, const std::string &itemValue)
 
void registerItem (const std::string &connectionString, const std::string &role, const std::string &itemName, const std::string &itemValue)
 
void reset ()
 
virtual ~AuthenticationCredentialSet ()
 Destructor. More...
 

Private Attributes

std::map< std::pair< std::string, std::string >, coral::AuthenticationCredentials * > m_data
 credentials for the specific roles More...
 

Detailed Description

Definition at line 23 of file CredentialStore.h.

Constructor & Destructor Documentation

coral_bridge::AuthenticationCredentialSet::AuthenticationCredentialSet ( )

Constructor.

Definition at line 33 of file CredentialStore.cc.

33  :
34  m_data(){
35 }
std::map< std::pair< std::string, std::string >, coral::AuthenticationCredentials * > m_data
credentials for the specific roles
coral_bridge::AuthenticationCredentialSet::~AuthenticationCredentialSet ( )
virtual

Destructor.

Definition at line 37 of file CredentialStore.cc.

References reset().

Member Function Documentation

const std::map< std::pair< std::string, std::string >, coral::AuthenticationCredentials * > & coral_bridge::AuthenticationCredentialSet::data ( ) const
const coral::IAuthenticationCredentials * coral_bridge::AuthenticationCredentialSet::get ( const std::string &  connectionString) const
const coral::IAuthenticationCredentials * coral_bridge::AuthenticationCredentialSet::get ( const std::string &  connectionString,
const std::string &  role 
) const

Definition at line 106 of file CredentialStore.cc.

References m_data.

Referenced by Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), data_sources.json_list::as_dicts(), data_sources.json_list::as_table(), rrapi.RRApi::columns(), util.rrapi.RRApi::columns(), util.rrapi.RRApi::count(), rrapi.RRApi::count(), util.rrapi.RRApi::data(), rrapi.RRApi::data(), data_sources.json_list::first(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getGeneral(), betterConfigParser.BetterConfigParser::getResultingSection(), data_sources.json_list::indices(), data_sources.json_list::last(), util.rrapi.RRApi::report(), rrapi.RRApi::report(), rrapi.RRApi::reports(), util.rrapi.RRApi::reports(), rrapi.RRApi::tables(), util.rrapi.RRApi::tables(), rrapi.RRApi::tags(), util.rrapi.RRApi::tags(), rrapi.RRApi::templates(), util.rrapi.RRApi::templates(), util.rrapi.RRApi::workspaces(), and rrapi.RRApi::workspaces().

107 {
108  const coral::IAuthenticationCredentials* ret = nullptr;
109  std::pair<std::string,std::string> connKey( connectionString, role );
110  std::map< std::pair<std::string,std::string>, coral::AuthenticationCredentials* >::const_iterator iData = m_data.find( connKey );
111  if ( iData != m_data.end() ){
112  ret = iData->second;
113  }
114  return ret;
115 }
std::map< std::pair< std::string, std::string >, coral::AuthenticationCredentials * > m_data
credentials for the specific roles
void coral_bridge::AuthenticationCredentialSet::import ( const AuthenticationCredentialSet data)

Definition at line 91 of file CredentialStore.cc.

References m_data, genParticles_cff::map, and registerCredentials().

91  {
92  for ( std::map< std::pair<std::string,std::string>, coral::AuthenticationCredentials* >::const_iterator iData = data.m_data.begin();
93  iData != data.m_data.end(); ++iData ){
94  registerCredentials( iData->first.first, iData->first.second, iData->second->valueForItem( coral::IAuthenticationCredentials::userItem() ),
95  iData->second->valueForItem( coral::IAuthenticationCredentials::passwordItem() ) );
96  }
97 }
const std::map< std::pair< std::string, std::string >, coral::AuthenticationCredentials * > & data() const
void registerCredentials(const std::string &connectionString, const std::string &userName, const std::string &password)
void coral_bridge::AuthenticationCredentialSet::registerCredentials ( const std::string &  connectionString,
const std::string &  userName,
const std::string &  password 
)

Adds a credential item to the default role.

Definition at line 69 of file CredentialStore.cc.

References cond::auth::COND_DEFAULT_ROLE.

Referenced by cond::CredentialStore::exportAll(), import(), and cond::CredentialStore::selectForUser().

71  {
72  registerCredentials( connectionString, cond::auth::COND_DEFAULT_ROLE, userName, password );
73 }
void registerCredentials(const std::string &connectionString, const std::string &userName, const std::string &password)
static constexpr const char *const COND_DEFAULT_ROLE
Definition: Auth.h:15
void coral_bridge::AuthenticationCredentialSet::registerCredentials ( const std::string &  connectionString,
const std::string &  role,
const std::string &  userName,
const std::string &  password 
)

Adds a credential item to the specified role.

Definition at line 76 of file CredentialStore.cc.

References m_data, and serviceName.

79  {
80  std::pair<std::string,std::string> connKey( connectionString, role );
81  std::map< std::pair<std::string,std::string>, coral::AuthenticationCredentials* >::iterator iData = m_data.find( connKey );
82  if( iData != m_data.end() ){
83  delete iData->second;
84  m_data.erase( connKey );
85  }
86  iData = m_data.insert( std::make_pair( connKey, new coral::AuthenticationCredentials( serviceName ) ) ).first;
87  iData->second->registerItem( coral::IAuthenticationCredentials::userItem(), userName );
88  iData->second->registerItem( coral::IAuthenticationCredentials::passwordItem(), password );
89 }
std::map< std::pair< std::string, std::string >, coral::AuthenticationCredentials * > m_data
credentials for the specific roles
static const std::string serviceName
void coral_bridge::AuthenticationCredentialSet::registerItem ( const std::string &  connectionString,
const std::string &  itemName,
const std::string &  itemValue 
)

Definition at line 48 of file CredentialStore.cc.

References cond::auth::COND_DEFAULT_ROLE.

50  {
51  registerItem( connectionString, cond::auth::COND_DEFAULT_ROLE, itemName, itemValue );
52 }
void registerItem(const std::string &connectionString, const std::string &itemName, const std::string &itemValue)
static constexpr const char *const COND_DEFAULT_ROLE
Definition: Auth.h:15
void coral_bridge::AuthenticationCredentialSet::registerItem ( const std::string &  connectionString,
const std::string &  role,
const std::string &  itemName,
const std::string &  itemValue 
)

Definition at line 55 of file CredentialStore.cc.

References m_data, and serviceName.

58  {
59  std::pair<std::string,std::string> connKey( connectionString, role );
60  std::map< std::pair<std::string,std::string>, coral::AuthenticationCredentials* >::iterator iData = m_data.find( connKey );
61  if( iData == m_data.end() ){
62  iData = m_data.insert( std::make_pair( connKey, new coral::AuthenticationCredentials( serviceName ) ) ).first;
63  }
64  iData = m_data.insert( std::make_pair( connKey, new coral::AuthenticationCredentials( serviceName ) ) ).first;
65  iData->second->registerItem( itemName, itemValue );
66 }
std::map< std::pair< std::string, std::string >, coral::AuthenticationCredentials * > m_data
credentials for the specific roles
static const std::string serviceName
void coral_bridge::AuthenticationCredentialSet::reset ( void  )

Definition at line 41 of file CredentialStore.cc.

References m_data, and genParticles_cff::map.

Referenced by MatrixReader.MatrixReader::__init__(), data_sources.json_list::next(), cond::RelationalAuthenticationService::RelationalAuthenticationService::setAuthenticationPath(), MatrixReader.MatrixReader::showRaw(), and ~AuthenticationCredentialSet().

41  {
42  for ( std::map< std::pair<std::string,std::string>, coral::AuthenticationCredentials* >::iterator iData = m_data.begin();
43  iData != m_data.end(); ++iData )
44  delete iData->second;
45  m_data.clear();
46 }
std::map< std::pair< std::string, std::string >, coral::AuthenticationCredentials * > m_data
credentials for the specific roles

Member Data Documentation

std::map< std::pair<std::string,std::string>, coral::AuthenticationCredentials* > coral_bridge::AuthenticationCredentialSet::m_data
private

credentials for the specific roles

Definition at line 70 of file CredentialStore.h.

Referenced by data(), get(), import(), registerCredentials(), registerItem(), and reset().