E-MailRelay
Classes | Public Member Functions | List of all members
GAuth::SaslClient Class Reference

A class that implements the client-side SASL challenge/response concept. More...

#include <gsaslclient.h>

Classes

struct  Response
 Result structure returned from GAuth::SaslClient::response. More...
 

Public Member Functions

 SaslClient (const SaslClientSecrets &secrets, const std::string &config)
 Constructor. The secrets reference is kept. More...
 
 ~SaslClient ()
 Destructor.
 
bool validSelector (std::string_view selector) const
 Returns true if the selector is valid. More...
 
bool mustAuthenticate (std::string_view selector) const
 Returns true if authentication is required. More...
 
Response response (std::string_view mechanism, std::string_view challenge, std::string_view selector) const
 Returns a response to the given challenge. More...
 
Response initialResponse (std::string_view selector, std::size_t limit=0U) const
 Returns an optional initial response. More...
 
std::string mechanism (const G::StringArray &mechanisms, std::string_view selector) const
 Returns the name of the preferred mechanism taken from the given set, taking into account what client secrets are available. More...
 
bool next ()
 Moves to the next preferred mechanism. More...
 
std::string next (const std::string &)
 A convenience overload that moves to the next() mechanism and returns it. More...
 
std::string mechanism () const
 Returns the name of the current mechanism once next() has returned true. More...
 
std::string id () const
 Returns the authentication id, valid after the last response(). More...
 
std::string info () const
 Returns logging and diagnostic information, valid after the last response(). More...
 
 SaslClient (const SaslClient &)=delete
 
 SaslClient (SaslClient &&)=delete
 
SaslClientoperator= (const SaslClient &)=delete
 
SaslClientoperator= (SaslClient &&)=delete
 

Detailed Description

A class that implements the client-side SASL challenge/response concept.

See also
GAuth::SaslServer, RFC-4422, RFC-2554.

Definition at line 41 of file gsaslclient.h.

Constructor & Destructor Documentation

◆ SaslClient()

GAuth::SaslClient::SaslClient ( const SaslClientSecrets secrets,
const std::string &  config 
)

Constructor. The secrets reference is kept.

Definition at line 287 of file gsaslclient.cpp.

Member Function Documentation

◆ id()

std::string GAuth::SaslClient::id ( ) const

Returns the authentication id, valid after the last response().

Definition at line 339 of file gsaslclient.cpp.

◆ info()

std::string GAuth::SaslClient::info ( ) const

Returns logging and diagnostic information, valid after the last response().

Definition at line 344 of file gsaslclient.cpp.

◆ initialResponse()

GAuth::SaslClient::Response GAuth::SaslClient::initialResponse ( std::string_view  selector,
std::size_t  limit = 0U 
) const

Returns an optional initial response.

Always returns the empty string if the mechanism is 'server-first'. Returns the empty string, with no side-effects, if the initial response is longer than the specified limit. Zero-length initial-responses are not distinguishable from absent initial-responses.

Definition at line 311 of file gsaslclient.cpp.

◆ mechanism() [1/2]

std::string GAuth::SaslClient::mechanism ( ) const

Returns the name of the current mechanism once next() has returned true.

Definition at line 334 of file gsaslclient.cpp.

◆ mechanism() [2/2]

std::string GAuth::SaslClient::mechanism ( const G::StringArray mechanisms,
std::string_view  selector 
) const

Returns the name of the preferred mechanism taken from the given set, taking into account what client secrets are available.

Returns the empty string if none is supported or if not active().

Definition at line 316 of file gsaslclient.cpp.

◆ mustAuthenticate()

bool GAuth::SaslClient::mustAuthenticate ( std::string_view  selector) const

Returns true if authentication is required.

Definition at line 300 of file gsaslclient.cpp.

◆ next() [1/2]

bool GAuth::SaslClient::next ( )

Moves to the next preferred mechanism.

Returns false if there are no more mechanisms.

Definition at line 321 of file gsaslclient.cpp.

◆ next() [2/2]

std::string GAuth::SaslClient::next ( const std::string &  s)

A convenience overload that moves to the next() mechanism and returns it.

Returns the empty string if the given string is empty or if there are no more mechanisms.

Definition at line 327 of file gsaslclient.cpp.

◆ response()

GAuth::SaslClient::Response GAuth::SaslClient::response ( std::string_view  mechanism,
std::string_view  challenge,
std::string_view  selector 
) const

Returns a response to the given challenge.

The mechanism is used to choose the appropriate entry in the secrets file.

Definition at line 305 of file gsaslclient.cpp.

◆ validSelector()

bool GAuth::SaslClient::validSelector ( std::string_view  selector) const

Returns true if the selector is valid.

Definition at line 295 of file gsaslclient.cpp.


The documentation for this class was generated from the following files: