E-MailRelay
Public Member Functions | Static Public Member Functions | List of all members
GAuth::Secrets Class Reference

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

#include <gsecrets.h>

+ Inheritance diagram for GAuth::Secrets:

Public Member Functions

 Secrets (const std::string &source_storage_path, const std::string &debug_name)
 Constructor. More...
 
 Secrets ()
 Default constructor for an in-valid(), empty-path object. More...
 
bool valid () const override
 Override from GAuth::Valid virtual base. More...
 
Secret serverSecret (const std::string &type, const std::string &id) const override
 Override from GAuth::SaslServerSecrets. More...
 
bool contains (const std::string &type) const override
 Override from GAuth::SaslServerSecrets. More...
 
 Secrets (const Secrets &)=delete
 
 Secrets (Secrets &&)=delete
 
void operator= (const Secrets &)=delete
 
void operator= (Secrets &&)=delete
 
virtual Secret clientSecret (const std::string &type) const =0
 Returns the client secret for the given type. More...
 
- Public Member Functions inherited from GAuth::Valid
virtual bool valid () const =0
 Returns true if a valid source of information. More...
 
virtual ~Valid ()=default
 Destructor.
 
virtual Secret serverSecret (const std::string &type, const std::string &id) const =0
 Returns the server secret for the given client id. More...
 
virtual std::pair< std::string, std::string > serverTrust (const std::string &address_range) const =0
 Returns a non-empty trustee name if the server trusts the given address range (eg. More...
 
virtual std::string source () const =0
 Returns the source identifier (eg. file name).
 
virtual bool contains (const std::string &mechanism) const =0
 Returns true if any user has a secret encoded for the given mechanism. More...
 

Static Public Member Functions

static void check (const std::string &, const std::string &, const std::string &)
 Checks the given secret sources. More...
 

Detailed Description

A simple interface for a store of secrets used in authentication.

The default implementation uses a flat file.

Definition at line 40 of file gsecrets.h.

Constructor & Destructor Documentation

◆ Secrets() [1/2]

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

Constructor.

The connection string is a secrets file path or "/pam".

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

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

Definition at line 40 of file gsecrets.cpp.

◆ Secrets() [2/2]

GAuth::Secrets::Secrets ( )

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

Definition at line 48 of file gsecrets.cpp.

Member Function Documentation

◆ check()

void GAuth::Secrets::check ( const std::string &  p1,
const std::string &  p2,
const std::string &  p3 
)
static

Checks the given secret sources.

Logs warnings and throws an exception if there are any fatal errors.

Definition at line 27 of file gsecrets.cpp.

◆ contains()

bool GAuth::Secrets::contains ( const std::string &  type) const
overridevirtual

Override from GAuth::SaslServerSecrets.

Implements GAuth::SaslServerSecrets.

Definition at line 82 of file gsecrets.cpp.

◆ serverSecret()

GAuth::Secret GAuth::Secrets::serverSecret ( const std::string &  type,
const std::string &  id 
) const
overridevirtual

Override from GAuth::SaslServerSecrets.

Implements GAuth::SaslServerSecrets.

Definition at line 72 of file gsecrets.cpp.

◆ valid()

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

Override from GAuth::Valid virtual base.

Implements GAuth::Valid.

Definition at line 62 of file gsecrets.cpp.


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