E-MailRelay

Classes | Public Member Functions | Static Public Member Functions | List of all members
GAuth::SecretsFile Class Reference

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...

## Detailed Description

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.

## Constructor & Destructor Documentation

## ◆ SecretsFile()

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.

## Member Function Documentation

## ◆ check()

void GAuth::SecretsFile::check | ( | const std::string & | path | ) |
| 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.

## ◆ clientSecret()

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.

## ◆ contains()

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.

## ◆ path()

std::string GAuth::SecretsFile::path | ( |  | ) | const

Returns the file path, as supplied to the ctor.

Definition at line 313 of file gsecretsfile.cpp.

## ◆ serverSecret()

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.

## ◆ serverTrust()

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.

## ◆ valid()

bool GAuth::SecretsFile::valid | ( |  | ) | const

Returns true if the file path was supplied in the ctor.

Definition at line 62 of file gsecretsfile.cpp.

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

- /usr/src/slapt-src-x86_64/network/emailrelay/emailrelay-2.3/src/gauth/gsecretsfile.h
- /usr/src/slapt-src-x86_64/network/emailrelay/emailrelay-2.3/src/gauth/gsecretsfile.cpp