E-MailRelay

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

gsecrets.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2001-2018 Graeme Walker <graeme_walker@users.sourceforge.net>
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 // ===
17 ///
18 /// \file gsecrets.h
19 ///
20
21 #ifndef G_AUTH_SECRETS_H
22 #define G_AUTH_SECRETS_H
23
24 #include "gdef.h"
25 #include "gpath.h"
26 #include "gexception.h"
27 #include "gsaslserversecrets.h"
28 #include "gsaslclientsecrets.h"
29
30 namespace GAuth
31 {
32 class Secrets ;
33 class SecretsFile ;
34 }
35
36 /// \class GAuth::Secrets
37 /// A simple interface for a store of secrets used in authentication.
38 /// The default implementation uses a flat file.
39 ///
40 class GAuth::Secrets : public SaslClientSecrets , public SaslServerSecrets
41 {
42 public:
43 G_EXCEPTION( OpenError , "cannot read secrets file" ) ;
44
45 Secrets( const std::string & source_storage_path , const std::string & debug_name ,
46 const std::string & server_type = std::string() ) ;
47 ///< Constructor. The connection string is a secrets file path
48 ///< or "/pam".
49 ///<
50 ///< The 'debug-name' is used in log and error messages to
51 ///< identify the repository.
52 ///<
53 ///< The 'server-type' parameter can be used to select
54 ///< a different set of server-side authentication records
55 ///< that may be stored in the same repository such as
56 ///< "smtp" or "pop". The default is "server".
57 ///<
58 ///< Throws on error, although an empty path is not
59 ///< considered an error: see valid().
60
61 Secrets() ;
62 ///< Default constructor for an in-valid(), empty-path object.
63
64 virtual ~Secrets() ;
65 ///< Destructor.
66
67 virtual std::string source() const override ;
68 ///< Override from GAuth::SaslServerSecrets.
69
70 virtual bool valid() const override ;
71 ///< Override from GAuth::Valid virtual base.
72
73 virtual Secret clientSecret( const std::string & mechanism ) const override ;
74 ///< Override from GAuth::SaslClientSecrets.
75
76 virtual Secret serverSecret( const std::string & mechanism ,
77 const std::string & id ) const override ;
78 ///< Override from GAuth::SaslServerSecrets.
79
80 virtual std::pair<std::string,std::string> serverTrust( const std::string & address_range ) const override ;
81 ///< Override from GAuth::SaslServerSecrets.
82
83 virtual bool contains( const std::string & mechanism ) const override ;
84 ///< Override from GAuth::SaslServerSecrets.
85
86 private:
87 Secrets( const Secrets & ) ;
88 void operator=( const Secrets & ) ;
89
90 private:
91 std::string m_source ;
92 SecretsFile * m_imp ;
93 } ;
94
95 #endif
GAuth::SaslClientSecrets
An interface used by GAuth::SaslClient to obtain a client id and its authentication secret...
Definition: gsaslclientsecrets.h:38
GAuth::Secrets::clientSecret
virtual Secret clientSecret(const std::string &mechanism) const override
Override from GAuth::SaslClientSecrets.
Definition: gsecrets.cpp:57
GAuth::Secrets::valid
virtual bool valid() const override
Override from GAuth::Valid virtual base.
Definition: gsecrets.cpp:52
gsaslclientsecrets.h
GAuth::Secrets::serverTrust
virtual std::pair< std::string, std::string > serverTrust(const std::string &address_range) const override
Override from GAuth::SaslServerSecrets.
Definition: gsecrets.cpp:67
GAuth::Secrets::Secrets
Secrets()
Default constructor for an in-valid(), empty-path object.
Definition: gsecrets.cpp:35
GAuth::SaslServerSecrets
An interface used by GAuth::SaslServer to obtain authentication secrets.
Definition: gsaslserversecrets.h:39
GAuth::SecretsFile
A class to read authentication secrets from file, used by GAuth::Secrets.
Definition: gsecretsfile.h:44
GAuth::Secrets
A simple interface for a store of secrets used in authentication.
Definition: gsecrets.h:40
GAuth::Secrets::serverSecret
virtual Secret serverSecret(const std::string &mechanism, const std::string &id) const override
Override from GAuth::SaslServerSecrets.
Definition: gsecrets.cpp:62
GAuth::Secrets::~Secrets
virtual ~Secrets()
Destructor.
Definition: gsecrets.cpp:42
GAuth::Secrets::source
virtual std::string source() const override
Override from GAuth::SaslServerSecrets.
Definition: gsecrets.cpp:47
gexception.h
gpath.h
GAuth::Secrets::contains
virtual bool contains(const std::string &mechanism) const override
Override from GAuth::SaslServerSecrets.
Definition: gsecrets.cpp:72
GAuth
SASL authentication classes.
Definition: gcram.h:30
gsaslserversecrets.h
GAuth::Secret
Encapsulates a shared secret from the secrets file plus the associated userid.
Definition: gsecret.h:42