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 active () const
 Returns true if the constructor's secrets object is valid. More...
 
Response response (const std::string &mechanism, const std::string &challenge) const
 Returns a response to the given challenge. More...
 
std::string initialResponse (std::size_t limit=0U) const
 Returns an optional initial response. More...
 
std::string mechanism (const G::StringArray &mechanisms) 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
 
void operator= (const SaslClient &)=delete
 
void operator= (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 40 of file gsaslclient.h.

Constructor & Destructor Documentation

◆ SaslClient()

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

Constructor. The secrets reference is kept.

Definition at line 270 of file gsaslclient.cpp.

Member Function Documentation

◆ active()

bool GAuth::SaslClient::active ( ) const

Returns true if the constructor's secrets object is valid.

Definition at line 278 of file gsaslclient.cpp.

◆ id()

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

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

Definition at line 314 of file gsaslclient.cpp.

◆ info()

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

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

Definition at line 319 of file gsaslclient.cpp.

◆ initialResponse()

std::string GAuth::SaslClient::initialResponse ( 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 288 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 309 of file gsaslclient.cpp.

◆ mechanism() [2/2]

std::string GAuth::SaslClient::mechanism ( const G::StringArray mechanisms) 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 293 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 298 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 303 of file gsaslclient.cpp.

◆ response()

GAuth::SaslClient::Response GAuth::SaslClient::response ( const std::string &  mechanism,
const std::string &  challenge 
) const

Returns a response to the given challenge.

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

Definition at line 283 of file gsaslclient.cpp.


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