gsaslclient.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2001-2013 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 // ===
20 
21 #ifndef G_SASL_CLIENT_H
22 #define G_SASL_CLIENT_H
23 
24 #include "gdef.h"
25 #include "gauth.h"
26 #include "gvalid.h"
27 #include "gexception.h"
28 #include "gaddress.h"
29 #include "gstrings.h"
30 #include "gpath.h"
31 #include <map>
32 #include <memory>
33 
35 namespace GAuth
36 {
37  class SaslClient ;
38  class SaslClientImp ;
39 }
40 
49 {
50 public:
52  class Secrets : public virtual Valid
53  {
54  public: virtual std::string id( const std::string & mechanism ) const = 0 ;
55  public: virtual std::string secret( const std::string & id ) const = 0 ;
56  public: virtual ~Secrets() ;
57  private: void operator=( const Secrets & ) ; // not implemented
58  } ;
59 
60  SaslClient( const Secrets & secrets , const std::string & server_name ) ;
62 
63  ~SaslClient() ;
65 
66  bool active() const ;
69 
70  std::string response( const std::string & mechanism , const std::string & challenge ,
71  bool & done , bool & error , bool & sensitive ) const ;
74 
75  std::string preferred( const G::Strings & mechanisms ) const ;
79 
80 private:
81  SaslClient( const SaslClient & ) ; // not implemented
82  void operator=( const SaslClient & ) ; // not implemented
83 
84 private:
85  SaslClientImp * m_imp ;
86 } ;
87 
88 #endif
std::string preferred(const G::Strings &mechanisms) const
Returns the name of the preferred mechanism taken from the given set.
std::string response(const std::string &mechanism, const std::string &challenge, bool &done, bool &error, bool &sensitive) const
Returns a response to the given challenge.
virtual std::string secret(const std::string &id) const =0
std::list< std::string > Strings
A std::list of std::strings.
Definition: gstrings.h:39
SaslClient(const Secrets &secrets, const std::string &server_name)
Constructor. The secrets reference is kept.
bool active() const
Returns true if the constructor's secrets object is valid.
A private pimple-pattern implementation class used by GAuth::SaslClient.
An interface used by GAuth::SaslClient to obtain authentication secrets.
Definition: gsaslclient.h:52
~SaslClient()
Destructor.
A class for implementing the client-side SASL challenge/response concept.
Definition: gsaslclient.h:48
virtual std::string id(const std::string &mechanism) const =0
SASL authentication classes.
A trivial mix-in interface containing a valid() method.
Definition: gvalid.h:35