MySQL 8.4.2
Source Code Documentation
auth_ldap_sasl_client::Sasl_mechanism Class Reference

Base class representing SASL mechanism. More...

#include <auth_ldap_sasl_mechanism.h>

Inheritance diagram for auth_ldap_sasl_client::Sasl_mechanism:
[legend]

Public Member Functions

virtual ~Sasl_mechanism ()=default
 Destructor. More...
 
virtual bool preauthenticate (const char *user, const char *password)
 Preauthentication step, e.g. More...
 
virtual const char * get_ldap_host ()
 Get LDAP host. More...
 
virtual bool get_default_user (std::string &name)
 Get default user name. More...
 
virtual const sasl_callback_t * get_callbacks ()
 Get list of supported SASL callbacks. More...
 
const char * get_mechanism_name ()
 Gets constans string describing mechanism name. More...
 
virtual bool require_conclude_by_server ()
 Check if the authentication method requires conclusion message from the server. More...
 

Static Public Member Functions

static bool create_sasl_mechanism (const char *mechanism_name, Sasl_mechanism *&mechanism)
 SASL mechanism factory function. More...
 

Static Public Attributes

static const char SASL_GSSAPI [] = "GSSAPI"
 GSSAPI string. More...
 
static const char SASL_SCRAM_SHA1 [] = "SCRAM-SHA-1"
 SCRAM-SHA-1 string. More...
 
static const char SASL_SCRAM_SHA256 [] = "SCRAM-SHA-256"
 SCRAM-SHA-256 string. More...
 

Protected Member Functions

 Sasl_mechanism (const char *mechanism_name)
 Constructor. More...
 

Private Attributes

const char * m_mechanism_name
 name of the mechanism More...
 

Static Private Attributes

static const sasl_callback_t callbacks []
 array of SASL callbacks More...
 

Detailed Description

Base class representing SASL mechanism.

The child classes are used to perform all mechanism specific SASL operations.

Constructor & Destructor Documentation

◆ ~Sasl_mechanism()

virtual auth_ldap_sasl_client::Sasl_mechanism::~Sasl_mechanism ( )
virtualdefault

Destructor.

◆ Sasl_mechanism()

auth_ldap_sasl_client::Sasl_mechanism::Sasl_mechanism ( const char *  mechanism_name)
inlineprotected

Constructor.

Made protected to avoid creating direct objects of this class.

Parameters
mechanism_name[in] name of the mechanism

Member Function Documentation

◆ create_sasl_mechanism()

bool auth_ldap_sasl_client::Sasl_mechanism::create_sasl_mechanism ( const char *  mechanism_name,
Sasl_mechanism *&  mechanism 
)
static

SASL mechanism factory function.

Creates mechanism object based on mechanism name.

Parameters
mechanism_name[in] name of the mechanism
mechanism[out] created mechanism object
Return values
truesuccess
falsefailure

◆ get_callbacks()

virtual const sasl_callback_t * auth_ldap_sasl_client::Sasl_mechanism::get_callbacks ( )
inlinevirtual

Get list of supported SASL callbacks.

Returns
List of callbacks.

Reimplemented in auth_ldap_sasl_client::Sasl_mechanism_kerberos, and auth_ldap_sasl_client::Sasl_mechanism_scram.

◆ get_default_user()

virtual bool auth_ldap_sasl_client::Sasl_mechanism::get_default_user ( std::string &  name)
inlinevirtual

Get default user name.

Called if no user name was provided as parameter to the client. Most methods don't provide default user name.

Parameters
name[out] default user name
Returns
false -failure

Reimplemented in auth_ldap_sasl_client::Sasl_mechanism_kerberos.

◆ get_ldap_host()

virtual const char * auth_ldap_sasl_client::Sasl_mechanism::get_ldap_host ( )
inlinevirtual

Get LDAP host.

Not needed by most methods, return nullptr by default.

Returns
LDAP host URL or nullptr on failure

Reimplemented in auth_ldap_sasl_client::Sasl_mechanism_kerberos.

◆ get_mechanism_name()

const char * auth_ldap_sasl_client::Sasl_mechanism::get_mechanism_name ( )
inline

Gets constans string describing mechanism name.

Returns
mechanism name

◆ preauthenticate()

virtual bool auth_ldap_sasl_client::Sasl_mechanism::preauthenticate ( const char *  user,
const char *  password 
)
inlinevirtual

Preauthentication step, e.g.

obtaining Kerberos ticket. Not needed by most methods, so the default implementation just returns success.

Parameters
user[in] user mname
password[in] user password
Returns
true -success

Reimplemented in auth_ldap_sasl_client::Sasl_mechanism_kerberos.

◆ require_conclude_by_server()

virtual bool auth_ldap_sasl_client::Sasl_mechanism::require_conclude_by_server ( )
inlinevirtual

Check if the authentication method requires conclusion message from the server.

Most authentication mechanisms don't require to be concluded by MySQL server, so the base class implementation always returns false.

Returns
false

Reimplemented in auth_ldap_sasl_client::Sasl_mechanism_kerberos.

Member Data Documentation

◆ callbacks

const sasl_callback_t auth_ldap_sasl_client::Sasl_mechanism::callbacks[]
staticprivate

array of SASL callbacks

◆ m_mechanism_name

const char* auth_ldap_sasl_client::Sasl_mechanism::m_mechanism_name
private

name of the mechanism

◆ SASL_GSSAPI

const char auth_ldap_sasl_client::Sasl_mechanism::SASL_GSSAPI = "GSSAPI"
static

GSSAPI string.

◆ SASL_SCRAM_SHA1

const char auth_ldap_sasl_client::Sasl_mechanism::SASL_SCRAM_SHA1 = "SCRAM-SHA-1"
static

SCRAM-SHA-1 string.

◆ SASL_SCRAM_SHA256

const char auth_ldap_sasl_client::Sasl_mechanism::SASL_SCRAM_SHA256 = "SCRAM-SHA-256"
static

SCRAM-SHA-256 string.


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