21#ifndef G_AUTH_SECRETS_FILE_H
22#define G_AUTH_SECRETS_FILE_H
48 G_EXCEPTION( Error ,
"invalid secrets file" ) ;
50 static void check(
const std::string &
path ) ;
69 std::pair<std::string,std::string>
serverTrust(
const std::string & address_range )
const ;
73 std::string
path()
const ;
76 bool contains(
const std::string & type ,
const std::string &
id = {} )
const ;
83 Value(
const std::string &s_,
unsigned int n_):s(s_),n(n_) {}
87 using Map = std::map<std::string,Value> ;
88 using Set = std::set<std::string> ;
89 using Warning = std::pair<unsigned long,std::string> ;
90 using Warnings = std::vector<Warning> ;
100 void reread()
const ;
102 static Contents readContents(
const G::Path & ) ;
103 static Contents readContents( std::istream & ) ;
104 static void processLine( Contents & ,
105 unsigned int ,
const std::string & side ,
const std::string & ,
const std::string & ,
const std::string & ) ;
106 static void processLineImp( Contents & ,
107 unsigned int ,
const std::string & side ,
const std::string & ,
const std::string & ,
const std::string & ) ;
108 static void showWarnings(
const Warnings & warnings ,
const G::Path &
path ,
const std::string & debug_name = {} ) ;
109 static void addWarning( Contents & ,
unsigned int ,
const std::string & ,
const std::string & = {} ) ;
110 static std::string canonical(
const std::string & encoding_type ) ;
111 static std::string serverKey(
const std::string & ,
const std::string & ) ;
112 static std::string clientKey(
const std::string & ) ;
114 static std::string line(
unsigned int ) ;
119 std::string m_debug_name ;
121 Contents m_contents ;
Encapsulates a shared secret from the secrets file plus the associated userid.
A class to read authentication secrets from file, used by GAuth::Secrets.
Secret serverSecret(const std::string &type, const std::string &id) const
Returns the server secret for the given id and type.
static void check(const std::string &path)
Checks the given file.
bool valid() const
Returns true if the file path was supplied in the ctor.
std::string path() const
Returns the file path, as supplied to the ctor.
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.
SecretsFile(const G::Path &path, bool auto_reread, const std::string &debug_name)
Constructor to read "client" and "server" records from the named file.
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,...
Secret clientSecret(const std::string &type) const
Returns the client id and secret for the given type.
A Path object represents a file system path.
Represents a unix-epoch time with microsecond resolution.
SASL authentication classes.