30 list.push_back( p1 ) ;
31 list.push_back( p2 ) ;
32 list.push_back( p3 ) ;
33 list.erase( std::remove(list.begin(),list.end(),std::string()) , list.end() ) ;
34 list.erase( std::remove(list.begin(),list.end(),
"/pam") , list.end() ) ;
35 std::sort( list.begin() , list.end() ) ;
36 list.erase( std::unique(list.begin(),list.end()) , list.end() ) ;
43 G_DEBUG(
"GAuth::Secrets:ctor: [" << path <<
"]" ) ;
44 if( m_source !=
"/pam" )
45 m_imp = std::make_unique<SecretsFile>( path ,
true , name ) ;
50 if( m_source !=
"/pam" )
51 m_imp = std::make_unique<SecretsFile>( std::string() ,
false , std::string() ) ;
54GAuth::Secrets::~Secrets()
57std::string GAuth::Secrets::source()
const
64 return m_source ==
"/pam" || m_imp->valid() ;
67GAuth::Secret GAuth::Secrets::clientSecret(
const std::string & type )
const
69 return valid() ? m_imp->clientSecret(type) :
Secret::none() ;
74 return valid() ? m_imp->serverSecret( type ,
id ) :
Secret::none() ;
77std::pair<std::string,std::string> GAuth::Secrets::serverTrust(
const std::string & address_range )
const
79 return valid() ? m_imp->serverTrust( address_range ) : std::make_pair(std::string(),std::string()) ;
84 return valid() ? m_imp->contains( type ) : false ;
Encapsulates a shared secret from the secrets file plus the associated userid.
static Secret none()
Factory function that returns a secret that is not valid() and has an empty id().
static void check(const std::string &path)
Checks the given file.
Secret serverSecret(const std::string &type, const std::string &id) const override
Override from GAuth::SaslServerSecrets.
bool contains(const std::string &type) const override
Override from GAuth::SaslServerSecrets.
static void check(const std::string &, const std::string &, const std::string &)
Checks the given secret sources.
Secrets()
Default constructor for an in-valid(), empty-path object.
bool valid() const override
Override from GAuth::Valid virtual base.
std::vector< std::string > StringArray
A std::vector of std::strings.