gsaslserver.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_SERVER_H
22 #define G_SASL_SERVER_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 SaslServer ;
38  class SaslServerImp ;
39 }
40 
78 {
79 public:
81  class Secrets : public virtual Valid
82  {
83  public: virtual std::string secret( const std::string & mechanism, const std::string & id ) const = 0 ;
84  public: virtual std::string source() const = 0 ;
85  public: virtual ~Secrets() ;
86  public: virtual bool contains( const std::string & mechanism ) const = 0 ;
87  private: void operator=( const Secrets & ) ; // not implemented
88  } ;
89 
90 public:
91  virtual ~SaslServer() ;
93 
94  virtual bool requiresEncryption() const = 0 ;
98 
99  virtual bool active() const = 0 ;
102 
103  virtual std::string mechanisms( char sep = ' ' ) const = 0 ;
109 
110  virtual bool init( const std::string & mechanism ) = 0 ;
113 
114  virtual std::string mechanism() const = 0 ;
117 
118  virtual bool mustChallenge() const = 0 ;
123 
124  virtual std::string initialChallenge() const = 0 ;
127 
128  virtual std::string apply( const std::string & response , bool & done ) = 0 ;
131 
132  virtual bool authenticated() const = 0 ;
135 
136  virtual std::string id() const = 0 ;
139 
140  virtual bool trusted( GNet::Address ) const = 0 ;
143 } ;
144 
145 #endif
virtual std::string mechanisms(char sep= ' ') const =0
Returns a list of supported, standard mechanisms that can be advertised to the client.
virtual std::string id() const =0
Returns the authenticated or trusted identity.
virtual bool requiresEncryption() const =0
Returns true if the implementation requires that the challenge/response dialog should only take place...
virtual std::string secret(const std::string &mechanism, const std::string &id) const =0
virtual bool authenticated() const =0
Returns true if authenticated sucessfully.
virtual bool active() const =0
Returns true if the constructor's "secrets" object was valid.
virtual std::string apply(const std::string &response, bool &done)=0
Applies the client response and returns the next challenge.
The Address class encapsulates an IP transport address.
Definition: gaddress.h:48
virtual std::string initialChallenge() const =0
Returns the initial server challenge.
virtual bool mustChallenge() const =0
Returns true if the mechanism must start with a non-empty server challenge.
virtual bool init(const std::string &mechanism)=0
Initialiser.
A class for implementing the server-side SASL challenge/response concept.
Definition: gsaslserver.h:77
virtual std::string mechanism() const =0
Returns the mechanism, as passed to the last init() call to return true.
virtual bool trusted(GNet::Address) const =0
Returns true if a trusted client that does not need to authenticate.
virtual bool contains(const std::string &mechanism) const =0
An interface used by GAuth::SaslServer to obtain authentication secrets.
Definition: gsaslserver.h:81
SASL authentication classes.
A trivial mix-in interface containing a valid() method.
Definition: gvalid.h:35
virtual ~SaslServer()
Destructor.
Definition: gsaslserver.cpp:26
virtual std::string source() const =0