E-MailRelay
gsaslserversecrets.h
Go to the documentation of this file.
1//
2// Copyright (C) 2001-2021 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
30namespace 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///
39class GAuth::SaslServerSecrets : public virtual Valid
40{
41public:
42 virtual Secret serverSecret( const std::string & type , const std::string & id ) const = 0 ;
43 ///< Returns the server secret for the given client id.
44 ///< The type is "plain" or the CRAM hash algorithm.
45 ///< Returns an invalid secret if not found.
46
47 virtual std::pair<std::string,std::string> serverTrust( const std::string & address_range ) const = 0 ;
48 ///< Returns a non-empty trustee name if the server trusts
49 ///< the given address range (eg. "192.168.0.0/24"), together
50 ///< with context information for logging purposes.
51
52 virtual std::string source() const = 0 ;
53 ///< Returns the source identifier (eg. file name).
54
55 virtual bool contains( const std::string & mechanism ) const = 0 ;
56 ///< Returns true if any user has a secret encoded for
57 ///< the given mechanism.
58} ;
59
60#endif
An interface used by GAuth::SaslServer to obtain authentication secrets.
virtual bool contains(const std::string &mechanism) const =0
Returns true if any user has a secret encoded for the given mechanism.
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 std::string source() const =0
Returns the source identifier (eg. file name).
virtual Secret serverSecret(const std::string &type, const std::string &id) const =0
Returns the server secret for the given client id.
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:35
SASL authentication classes.
Definition: gcram.cpp:36