E-MailRelay
gsaslserverbasic.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 gsaslserverbasic.h
19///
20
21#ifndef G_SASL_SERVER_BASIC_H
22#define G_SASL_SERVER_BASIC_H
23
24#include "gdef.h"
25#include "gsecrets.h"
26#include "gsaslserver.h"
27#include "gexception.h"
28#include "gaddress.h"
29#include "gstringarray.h"
30#include "goptional.h"
31#include "gpath.h"
32#include <memory>
33#include <utility>
34
35namespace GAuth
36{
37 class SaslServerBasicImp ;
38 class SaslServerBasic ;
39}
40
41//| \class GAuth::SaslServerBasic
42/// An implementation of the SaslServer interface that does not use PAM.
43/// \see GAuth::SaslServerPam
44///
46{
47public:
48 explicit SaslServerBasic( const SaslServerSecrets & , bool allow_pop ,
49 const std::string & config , const std::string & challenge_domain ) ;
50 ///< Constructor. The 'config' parameters can be used to reduce the
51 ///< set of available authentication mechanisms.
52
53public:
54 ~SaslServerBasic() override ;
55 SaslServerBasic( const SaslServerBasic & ) = delete ;
56 SaslServerBasic( SaslServerBasic && ) = delete ;
57 SaslServerBasic & operator=( const SaslServerBasic & ) = delete ;
58 SaslServerBasic & operator=( SaslServerBasic && ) = delete ;
59
60private: // overrides
61 void reset() override ; // Override from GAuth::SaslServer.
62 G::StringArray mechanisms( bool ) const override ; // Override from GAuth::SaslServer.
63 bool init( bool , const std::string & mechanism ) override ; // Override from GAuth::SaslServer.
64 std::string mechanism() const override ; // Override from GAuth::SaslServer.
65 std::string preferredMechanism( bool ) const override ; // Override from GAuth::SaslServer.
66 bool mustChallenge() const override ; // Override from GAuth::SaslServer.
67 std::string initialChallenge() const override ; // Override from GAuth::SaslServer.
68 std::string apply( const std::string & response , bool & done ) override ; // Override from GAuth::SaslServer.
69 bool authenticated() const override ; // Override from GAuth::SaslServer.
70 std::string id() const override ; // Override from GAuth::SaslServer.
71 bool trusted( const G::StringArray & , const std::string & ) const override ; // Override from GAuth::SaslServer.
72
73private:
74 std::unique_ptr<SaslServerBasicImp> m_imp ;
75} ;
76
77#endif
An implementation of the SaslServer interface that does not use PAM.
SaslServerBasic(const SaslServerSecrets &, bool allow_pop, const std::string &config, const std::string &challenge_domain)
Constructor.
An interface used by GAuth::SaslServer to obtain authentication secrets.
An interface for implementing the server-side SASL challenge/response concept.
Definition: gsaslserver.h:76
SASL authentication classes.
Definition: gcram.cpp:38
std::vector< std::string > StringArray
A std::vector of std::strings.
Definition: gstringarray.h:30