E-MailRelay

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

gsaslclient.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 gsaslclient.h
19 ///
20
21 #ifndef G_SASL_CLIENT_H
22 #define G_SASL_CLIENT_H
23
24 #include "gdef.h"
25 #include "gsaslclientsecrets.h"
26 #include "gexception.h"
27 #include "gstrings.h"
28
29 namespace GAuth
30 {
31 class SaslClient ;
32 class SaslClientImp ;
33 }
34
35 /// \class GAuth::SaslClient
36 /// A class that implements the client-side SASL challenge/response concept.
37 /// \see GAuth::SaslServer, RFC-4422, RFC-2554.
38 ///
39 class GAuth::SaslClient
40 {
41 public:
42 struct Response /// Result structure returned from GAuth::SaslClient::response
43 {
44 std::string data ;
45 bool sensitive ; // don't log
46 bool error ; // abort the sasl dialog
47 bool final ; // final response, server's decision time
48 } ;
49
50 explicit SaslClient( const SaslClientSecrets & secrets ) ;
51 ///< Constructor. The secrets reference is kept.
52
53 ~SaslClient() ;
54 ///< Destructor.
55
56 bool active() const ;
57 ///< Returns true if the constructor's secrets object is valid.
58
59 Response response( const std::string & mechanism , const std::string & challenge ) const ;
60 ///< Returns a response to the given challenge. The mechanism is
61 ///< used to choose the appropriate entry in the secrets file.
62
63 std::string preferred( const G::StringArray & mechanisms ) const ;
64 ///< Returns the name of the preferred mechanism taken from the given
65 ///< set, taking into account what client secrets are available.
66 ///< Returns the empty string if none is supported or if not active().
67
68 bool next() ;
69 ///< Moves to the next preferred mechanism.
70
71 std::string preferred() const ;
72 ///< Returns the name of the current preferred mechanism after
73 ///< next() returns true.
74
75 std::string id() const ;
76 ///< Returns the authentication id, valid after the last
77 ///< response().
78
79 std::string info() const ;
80 ///< Returns logging and diagnostic information, valid after
81 ///< the last response().
82
83 private:
84 SaslClient( const SaslClient & ) ;
85 void operator=( const SaslClient & ) ;
86
87 private:
88 SaslClientImp * m_imp ;
89 } ;
90
91 #endif
gstrings.h
GAuth::SaslClient::info
std::string info() const
Returns logging and diagnostic information, valid after the last response().
Definition: gsaslclient.cpp:273
GAuth::SaslClientSecrets
An interface used by GAuth::SaslClient to obtain a client id and its authentication secret...
Definition: gsaslclientsecrets.h:38
gsaslclientsecrets.h
GAuth::SaslClient::SaslClient
SaslClient(const SaslClientSecrets &secrets)
Constructor. The secrets reference is kept.
Definition: gsaslclient.cpp:233
G::StringArray
std::vector< std::string > StringArray
A std::vector of std::strings.
Definition: gstrings.h:33
GAuth::SaslClient::active
bool active() const
Returns true if the constructor's secrets object is valid.
Definition: gsaslclient.cpp:243
GAuth::SaslClient::response
Response response(const std::string &mechanism, const std::string &challenge) const
Returns a response to the given challenge.
Definition: gsaslclient.cpp:248
GAuth::SaslClient::id
std::string id() const
Returns the authentication id, valid after the last response().
Definition: gsaslclient.cpp:268
GAuth::SaslClientImp
A private pimple-pattern implementation class used by GAuth::SaslClient.
Definition: gsaslclient.cpp:43
gexception.h
GAuth::SaslClient::~SaslClient
~SaslClient()
Destructor.
Definition: gsaslclient.cpp:238
GAuth::SaslClient
A class that implements the client-side SASL challenge/response concept.
Definition: gsaslclient.h:39
GAuth::SaslClient::next
bool next()
Moves to the next preferred mechanism.
Definition: gsaslclient.cpp:258
GAuth
SASL authentication classes.
Definition: gcram.h:30
GAuth::SaslClient::preferred
std::string preferred() const
Returns the name of the current preferred mechanism after next() returns true.
Definition: gsaslclient.cpp:263
GAuth::SaslClient::Response
Result structure returned from GAuth::SaslClient::response.
Definition: gsaslclient.h:42