E-MailRelay
gsaslclientsecrets.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 gsaslclientsecrets.h
19///
20
21#ifndef G_SASL_CLIENT_SECRETS_H
22#define G_SASL_CLIENT_SECRETS_H
23
24#include "gdef.h"
25#include "gsecret.h"
26#include "gstringview.h"
27
28namespace GAuth
29{
30 class SaslClientSecrets ;
31}
32
33//| \class GAuth::SaslClientSecrets
34/// An interface used by GAuth::SaslClient to obtain a client id and
35/// its authentication secret. Conceptually there is one client and
36/// they can have secrets encoded in multiple ways.
37///
39{
40public:
41 virtual ~SaslClientSecrets() = default ;
42 ///< Destructor.
43
44 virtual bool validSelector( std::string_view selector ) const = 0 ;
45 ///< Returns true if the selector is valid.
46
47 virtual bool mustAuthenticate( std::string_view selector ) const = 0 ;
48 ///< Returns true if authentication is required.
49 ///< Precondition: validSelector()
50
51 virtual Secret clientSecret( std::string_view type , std::string_view selector ) const = 0 ;
52 ///< Returns the client secret for the given type. The
53 ///< type is "plain" or the CRAM hash algorithm or "oauth".
54 ///< The optional selector is used to choose between
55 ///< available client accounts. Returns an invalid secret
56 ///< if none.
57} ;
58
59#endif
An interface used by GAuth::SaslClient to obtain a client id and its authentication secret.
virtual bool validSelector(std::string_view selector) const =0
Returns true if the selector is valid.
virtual bool mustAuthenticate(std::string_view selector) const =0
Returns true if authentication is required.
virtual Secret clientSecret(std::string_view type, std::string_view selector) const =0
Returns the client secret for the given type.
virtual ~SaslClientSecrets()=default
Destructor.
Encapsulates a userid/shared-secret/hash-function tuple from the secrets file.
Definition: gsecret.h:44
SASL authentication classes.
Definition: gcram.cpp:38