E-MailRelay
gsaslserversecrets.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 gsaslserversecrets.h
19 ///
20 
21 #ifndef GAUTH_SASL_SERVER_SECRETS_H
22 #define GAUTH_SASL_SERVER_SECRETS_H
23 
24 #include "gdef.h"
25 #include "gvalid.h"
26 #include "gsecret.h"
27 #include <string>
28 #include <utility>
29 
30 namespace GAuth
31 {
32  class SaslServerSecrets ;
33 }
34 
35 /// \class GAuth::SaslServerSecrets
36 /// An interface used by GAuth::SaslServer to obtain authentication secrets.
37 /// \see GAuth::Secret
38 ///
39 class GAuth::SaslServerSecrets : public virtual Valid
40 {
41 public:
42  virtual Secret serverSecret( const std::string & encoding_type , const std::string & id ) const = 0 ;
43  ///< Returns the server secret for the given client id.
44  ///< Returns an invalid secret if not found.
45 
46  virtual std::pair<std::string,std::string> serverTrust( const std::string & address_range ) const = 0 ;
47  ///< Returns a non-empty trustee name if the server trusts
48  ///< the given address range (eg. "192.168.0.0/24"), together
49  ///< with context information for logging purposes.
50 
51  virtual std::string source() const = 0 ;
52  ///< Returns the source identifier (eg. file name).
53 
54  virtual bool contains( const std::string & mechanism ) const = 0 ;
55  ///< Returns true if any user has a secret encoded for
56  ///< the given mechanism.
57 
58 protected:
59  virtual ~SaslServerSecrets() ;
60 
61 private:
62  void operator=( const SaslServerSecrets & ) ;
63 } ;
64 
65 #endif
virtual std::pair< std::string, std::string > serverTrust(const std::string &address_range) const =0
Returns a non-empty trustee name if the server trusts the given address range (eg.
virtual bool contains(const std::string &mechanism) const =0
Returns true if any user has a secret encoded for the given mechanism.
virtual Secret serverSecret(const std::string &encoding_type, const std::string &id) const =0
Returns the server secret for the given client id.
An interface used by GAuth::SaslServer to obtain authentication secrets.
virtual std::string source() const =0
Returns the source identifier (eg. file name).
SASL authentication classes.
Definition: gcram.h:30
Encapsulates a shared secret from the secrets file plus the associated userid.
Definition: gsecret.h:42
A trivial mix-in interface containing a valid() method.
Definition: gvalid.h:33