E-MailRelay

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

gpopsecrets.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 gpopsecrets.h
19 ///
20
21 #ifndef G_POP_SECRETS_H
22 #define G_POP_SECRETS_H
23
24 #include "gdef.h"
25 #include "gpop.h"
26 #include "gsecrets.h"
27 #include "gsaslserversecrets.h"
28 #include "gpath.h"
29 #include "gexception.h"
30 #include <iostream>
31 #include <utility>
32 #include <map>
33
34 namespace GPop
35 {
36 class Secrets ;
37 class SecretsImp ;
38 }
39
40 /// \class GPop::Secrets
41 /// A simple interface to a store of secrets as used in authentication.
42 ///
43 class GPop::Secrets : public GAuth::SaslServerSecrets
44 {
45 public:
46 G_EXCEPTION( OpenError , "cannot open pop secrets file" ) ;
47
48 static std::string defaultPath() ;
49 ///< Returns the default path.
50
51 explicit Secrets( const std::string & storage_path = defaultPath() ) ;
52 ///< Constructor. In principle the storage_path can
53 ///< be a path to a file, a database connection
54 ///< string, etc. Throws on error.
55
56 virtual ~Secrets() ;
57 ///< Destructor.
58
59 std::string path() const ;
60 ///< Returns the storage path.
61
62 virtual bool valid() const override ;
63 ///< Override from GSmtp::Valid virtual base class.
64
65 virtual std::string source() const override ;
66 ///< Override from GAuth::SaslServerSecrets.
67
68 virtual GAuth::Secret serverSecret( const std::string & encoding_type , const std::string & id ) const override ;
69 ///< Override from GSmtp::SaslServer::Secrets.
70
71 virtual std::pair<std::string,std::string> serverTrust( const std::string & ) const override ;
72 ///< Override from GSmtp::SaslServer::Secrets.
73
74 bool contains( const std::string & mechanism ) const ;
75 ///< Returns true if there is one or more secrets
76 ///< using the given mechanism.
77
78 private:
79 Secrets( const Secrets & ) ; // not implemented
80 void operator=( const Secrets & ) ; // not implemented
81
82 private:
83 SecretsImp * m_imp ;
84 } ;
85
86 #endif
87
GPop::Secrets
A simple interface to a store of secrets as used in authentication.
Definition: gpopsecrets.h:43
GPop::Secrets::contains
bool contains(const std::string &mechanism) const
Returns true if there is one or more secrets using the given mechanism.
Definition: gpop_disabled.cpp:57
GAuth::SaslServerSecrets
An interface used by GAuth::SaslServer to obtain authentication secrets.
Definition: gsaslserversecrets.h:39
GPop::Secrets::serverSecret
virtual GAuth::Secret serverSecret(const std::string &encoding_type, const std::string &id) const override
Override from GSmtp::SaslServer::Secrets.
Definition: gpopsecrets.cpp:68
gsecrets.h
GPop::Secrets::valid
virtual bool valid() const override
Override from GSmtp::Valid virtual base class.
Definition: gpop_disabled.cpp:42
GPop::Secrets::Secrets
Secrets(const std::string &storage_path=defaultPath())
Constructor.
Definition: gpop_disabled.cpp:34
GPop::SecretsImp
A private pimple-pattern implementation class used by GPop::Secrets.
Definition: gpopsecrets.cpp:30
GPop::Secrets::~Secrets
virtual ~Secrets()
Destructor.
Definition: gpop_disabled.cpp:38
gpop.h
gexception.h
gpath.h
GPop::Secrets::serverTrust
virtual std::pair< std::string, std::string > serverTrust(const std::string &) const override
Override from GSmtp::SaslServer::Secrets.
Definition: gpopsecrets.cpp:73
GPop::Secrets::path
std::string path() const
Returns the storage path.
Definition: gpopsecrets.cpp:53
GPop::Secrets::source
virtual std::string source() const override
Override from GAuth::SaslServerSecrets.
Definition: gpop_disabled.cpp:47
GPop
POP3 classes.
Definition: gpopauth.h:28
gsaslserversecrets.h
GAuth::Secret
Encapsulates a shared secret from the secrets file plus the associated userid.
Definition: gsecret.h:42
GPop::Secrets::defaultPath
static std::string defaultPath()
Returns the default path.
Definition: gpop_disabled.cpp:29