E-MailRelay

gsaslserversecrets.h
Go to the documentation of this file.
1//
2// Copyright (C) 2001-2024 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 "gsecret.h"
26#include "gstringview.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
40{
41 public:
42 virtual ~SaslServerSecrets() = default ;
43 ///< Destructor.
44
45 virtual bool valid() const = 0 ;
46 ///< Returns true if the secrets are valid.
47
48 virtual Secret serverSecret( std::string_view type , std::string_view id ) const = 0 ;
49 ///< Returns the server secret for the given client id.
50 ///< The type is "plain" or the CRAM hash algorithm.
51 ///< Returns an invalid secret if not found.
52
53 virtual std::pair<std::string,std::string> serverTrust( const std::string & address_range ) const = 0 ;
54 ///< Returns a non-empty trustee name if the server trusts
55 ///< the given address range (eg. "192.168.0.0/24"), together
56 ///< with context information for logging purposes.
57
58 virtual std::string source() const = 0 ;
59 ///< Returns the source identifier (eg. file name).
60
61 virtual bool contains( std::string_view type , std::string_view id ) const = 0 ;
62 ///< Returns true if there is a secret of the given type
63 ///< either for one user in particular or for any user if
64 ///< the id is empty.
65} ;
66
67#endif
GAuth::SaslServerSecrets
An interface used by GAuth::SaslServer to obtain authentication secrets.
Definition: gsaslserversecrets.h:40
GAuth::SaslServerSecrets::serverSecret
virtual Secret serverSecret(std::string_view type, std::string_view id) const =0
Returns the server secret for the given client id.
GAuth::SaslServerSecrets::valid
virtual bool valid() const =0
Returns true if the secrets are valid.
GAuth::SaslServerSecrets::serverTrust
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.
GAuth::SaslServerSecrets::contains
virtual bool contains(std::string_view type, std::string_view id) const =0
Returns true if there is a secret of the given type either for one user in particular or for any user...
GAuth::SaslServerSecrets::source
virtual std::string source() const =0
Returns the source identifier (eg. file name).
GAuth::SaslServerSecrets::~SaslServerSecrets
virtual ~SaslServerSecrets()=default
Destructor.
GAuth::Secret
Encapsulates a userid/shared-secret/hash-function tuple from the secrets file.
Definition: gsecret.h:44
gsecret.h
gstringview.h
GAuth
SASL authentication classes.
Definition: gcram.cpp:38