Public Member Functions | List of all members
GAuth::Secrets Class Reference

A simple interface to a store of secrets as used in authentication. More...

#include <gsecrets.h>

Inheritance diagram for GAuth::Secrets:
GAuth::SaslClient::Secrets GAuth::SaslServer::Secrets GAuth::Valid GAuth::Valid

Public Member Functions

 Secrets (const std::string &source_storage_path, const std::string &debug_name, const std::string &server_type=std::string())
 Constructor. More...
 
 Secrets ()
 Default constructor for an in-valid(), empty-path object. More...
 
virtual ~Secrets ()
 Destructor. More...
 
virtual std::string source () const
 Final override from GAuth::SaslServer::Secrets. More...
 
virtual bool valid () const
 Final override from GAuth::Valid virtual base. More...
 
virtual std::string id (const std::string &mechanism) const
 Final override from GAuth::SaslClient::Secrets. More...
 
virtual std::string secret (const std::string &mechanism) const
 Final override from GAuth::SaslClient::Secrets. More...
 
virtual std::string secret (const std::string &mechanism, const std::string &id) const
 Final override from GAuth::SaslServer::Secrets. More...
 
virtual bool contains (const std::string &mechanism) const
 Final override from GAuth::SaslServer::Secrets. More...
 
- Public Member Functions inherited from GAuth::Valid
virtual ~Valid ()
 Destructor. More...
 

Detailed Description

A simple interface to a store of secrets as used in authentication.

The default implementation uses a flat file.

See also
GAuth::SaslClient, GAuth::SaslServer

Definition at line 44 of file gsecrets.h.

Constructor & Destructor Documentation

GAuth::Secrets::Secrets ( const std::string &  source_storage_path,
const std::string &  debug_name,
const std::string &  server_type = std::string() 
)

Constructor.

In principle the repository 'storage-path' can be a path to a file, a database connection string, etc.

The 'debug-name' is used in log and error messages to identify the repository.

The 'server-type' parameter can be used to select a different set of server-side authentication records that may be stored in the same repository.

Throws on error, although an empty path is not considered an error: see valid().

Definition at line 26 of file gsecrets_full.cpp.

GAuth::Secrets::Secrets ( )

Default constructor for an in-valid(), empty-path object.

Definition at line 32 of file gsecrets_full.cpp.

GAuth::Secrets::~Secrets ( )
virtual

Destructor.

Reimplemented from GAuth::SaslClient::Secrets.

Definition at line 37 of file gsecrets_full.cpp.

Member Function Documentation

bool GAuth::Secrets::contains ( const std::string &  mechanism) const
virtual

Final override from GAuth::SaslServer::Secrets.

Returns true if there is one or more server secrets using the given mechanism. This can be used to limit the list of mechanisms advertised by a server.

Implements GAuth::SaslServer::Secrets.

Definition at line 67 of file gsecrets_full.cpp.

std::string GAuth::Secrets::id ( const std::string &  mechanism) const
virtual

Final override from GAuth::SaslClient::Secrets.

Returns the default id for client-side authentication.

Implements GAuth::SaslClient::Secrets.

Definition at line 52 of file gsecrets_full.cpp.

std::string GAuth::Secrets::secret ( const std::string &  mechanism) const
virtual

Final override from GAuth::SaslClient::Secrets.

Returns the default secret for client-side authentication.

Implements GAuth::SaslClient::Secrets.

Definition at line 57 of file gsecrets_full.cpp.

std::string GAuth::Secrets::secret ( const std::string &  mechanism,
const std::string &  id 
) const
virtual

Final override from GAuth::SaslServer::Secrets.

Returns the given user's secret for server-side authentication. Returns the empty string if not a valid id.

Implements GAuth::SaslServer::Secrets.

Definition at line 62 of file gsecrets_full.cpp.

std::string GAuth::Secrets::source ( ) const
virtual

Final override from GAuth::SaslServer::Secrets.

Returns the source storage path as passed in to the constructor.

Implements GAuth::SaslServer::Secrets.

Definition at line 42 of file gsecrets_full.cpp.

bool GAuth::Secrets::valid ( ) const
virtual

Final override from GAuth::Valid virtual base.

The implementation returns false if the path was empty.

Implements GAuth::Valid.

Definition at line 47 of file gsecrets_full.cpp.

Referenced by GPop::SecretsImp::SecretsImp().


The documentation for this class was generated from the following files: