E-MailRelay
|
A class to read authentication secrets from file, used by GAuth::Secrets. More...
#include <gsecretsfile.h>
Public Member Functions | |
SecretsFile (const G::Path &path, bool auto_reread, const std::string &debug_name) | |
Constructor to read "client" and "server" records from the named file. More... | |
bool | valid () const |
Returns true if the file path was supplied in the ctor. More... | |
Secret | clientSecret (const std::string &type) const |
Returns the client id and secret for the given type. More... | |
Secret | serverSecret (const std::string &type, const std::string &id) const |
Returns the server secret for the given id and type. More... | |
std::pair< std::string, std::string > | serverTrust (const std::string &address_range) const |
Returns a non-empty trustee name if the server trusts clients in the given address range, together with context information. More... | |
std::string | path () const |
Returns the file path, as supplied to the ctor. More... | |
bool | contains (const std::string &type, const std::string &id={}) const |
Returns true if a server secret of the given type is available for the particular user or any user. More... | |
Static Public Member Functions | |
static void | check (const std::string &path) |
Checks the given file. More... | |
A class to read authentication secrets from file, used by GAuth::Secrets.
Updates to the file are detected automatically.
Definition at line 45 of file gsecretsfile.h.
GAuth::SecretsFile::SecretsFile | ( | const G::Path & | path, |
bool | auto_reread, | ||
const std::string & | debug_name | ||
) |
Constructor to read "client" and "server" records from the named file.
The path is optional; see valid().
Definition at line 39 of file gsecretsfile.cpp.
|
static |
Checks the given file.
Logs warnings and throws an exception if there are any fatal errors.
Definition at line 51 of file gsecretsfile.cpp.
GAuth::Secret GAuth::SecretsFile::clientSecret | ( | const std::string & | type | ) | const |
Returns the client id and secret for the given type.
Returns the empty string if none.
Definition at line 262 of file gsecretsfile.cpp.
bool GAuth::SecretsFile::contains | ( | const std::string & | type, |
const std::string & | id = {} |
||
) | const |
Returns true if a server secret of the given type is available for the particular user or any user.
Definition at line 318 of file gsecretsfile.cpp.
std::string GAuth::SecretsFile::path | ( | ) | const |
Returns the file path, as supplied to the ctor.
Definition at line 313 of file gsecretsfile.cpp.
GAuth::Secret GAuth::SecretsFile::serverSecret | ( | const std::string & | type, |
const std::string & | id | ||
) | const |
Returns the server secret for the given id and type.
Returns the empty string if none.
Definition at line 279 of file gsecretsfile.cpp.
std::pair< std::string, std::string > GAuth::SecretsFile::serverTrust | ( | const std::string & | address_range | ) | const |
Returns a non-empty trustee name if the server trusts clients in the given address range, together with context information.
Definition at line 297 of file gsecretsfile.cpp.
bool GAuth::SecretsFile::valid | ( | ) | const |
Returns true if the file path was supplied in the ctor.
Definition at line 62 of file gsecretsfile.cpp.