MySQL 9.1.0
Source Code Documentation
authentication_policy::Policy Class Reference

Class representing authentication policy. More...

#include <authentication_policy.h>

Protected Member Functions

 ~Policy ()
 Destructor. More...
 
bool validate (const char *new_policy)
 Validate @authentication_policy variable value. More...
 
bool update (const char *new_policy)
 Update @authentication_policy variable value. More...
 
void get_factors (Factors &factors) const
 Get copy of the authentication policy factors. More...
 
void get_default_plugin (size_t factor, std::string &name) const
 Get copy of default plugin name. More...
 
void get_default_plugin (size_t factor, MEM_ROOT *mem_root, LEX_CSTRING *name) const
 Get copy of default plugin name. More...
 

Static Protected Member Functions

static bool parse (const std::string &new_policy_value, Factors &parsed_factors)
 Parse @authentication_policy variable value. More...
 

Static Protected Attributes

static Policypolicy
 Pointer to the authentication policy object. More...
 

Private Member Functions

void release_plugin_refs ()
 Release all plugin references and clear plugin_refs container. More...
 
st_mysql_authget_mysql_auth (const std::string &plugin_name)
 Get server authentication plugin descriptor by plugin name. More...
 

Private Attributes

Factors factors
 Actual authentication policy factors. More...
 
Factors new_factors
 Verified, but not yet set authentication policy factors. More...
 
std::string verified_policy_value
 The verified policy value. More...
 
std::vector< plugin_refplugin_refs
 

Friends

bool policy_validate (const char *new_policy)
 Validate @authentication_policy variable value. More...
 
bool policy_update (const char *new_policy)
 Validate @authentication_policy variable value. More...
 
void get_policy_factors (Factors &factors)
 Get copy of the authentication policy factors. More...
 
void get_first_factor_default_plugin (std::string &name)
 Get copy of first factor default plugin name. More...
 
void get_first_factor_default_plugin (MEM_ROOT *mem_root, LEX_CSTRING *name)
 Get copy of default plugin name. More...
 
int init (const char *opt_authentication_policy)
 Initialize authentication policy. More...
 
void deinit ()
 Component deinitialization. More...
 

Detailed Description

Class representing authentication policy.

Constructor & Destructor Documentation

◆ ~Policy()

authentication_policy::Policy::~Policy ( )
inlineprotected

Destructor.

Member Function Documentation

◆ get_default_plugin() [1/2]

void authentication_policy::Policy::get_default_plugin ( size_t  factor,
MEM_ROOT mem_root,
LEX_CSTRING name 
) const
protected

Get copy of default plugin name.

Parameters
factor[in] no of the factor
mem_root[in] place to allocate the name
name[out] copy of the name

◆ get_default_plugin() [2/2]

void authentication_policy::Policy::get_default_plugin ( size_t  factor,
std::string &  name 
) const
protected

Get copy of default plugin name.

Parameters
factor[in] no of the factor
name[out] copy of the name

◆ get_factors()

void authentication_policy::Policy::get_factors ( Factors factors) const
protected

Get copy of the authentication policy factors.

The aim is to work is with consistent snapshot of the factor avoiding long time locking.

Parameters
factors[out] authentication policy factors

◆ get_mysql_auth()

st_mysql_auth * authentication_policy::Policy::get_mysql_auth ( const std::string &  plugin_name)
private

Get server authentication plugin descriptor by plugin name.

Store the descriptor in plugin_refs.

Parameters
plugin_name[in] name of the plugin
Returns
server authentication plugin descriptor

◆ parse()

bool authentication_policy::Policy::parse ( const std::string &  new_policy_value,
Factors parsed_factors 
)
staticprotected

Parse @authentication_policy variable value.

Format of the variable: authentication_policy = factor_spec[, factor_spec] ... factor_spec = [ * | <empty> | mandatory_plugin | :default_plugin ]

Additional rules: The first plugin cannot be empty (optional) An empty (optional) plugin can be followed only by empty (optional) plugins. The number of factors is limited to 3.

Below are some invalid values: ',,' ',authentication_fido,' ',:caching_sha2_password' 'caching_sha2_password,,authentication_fido' 'caching_sha2_password,:authentication_ldap_simple,authentication_fido' ',authentication_fido,authentication_ldap_simple' ',*:authentication_fido,' 'caching_sha2_password:authentication_ldap_simple'

Parameters
new_policy_value[in] new value of the variable
parsed_factors[out] parsed factors
Return values
falseOK
trueError

◆ release_plugin_refs()

void authentication_policy::Policy::release_plugin_refs ( )
inlineprivate

Release all plugin references and clear plugin_refs container.

◆ update()

bool authentication_policy::Policy::update ( const char *  new_policy)
protected

Update @authentication_policy variable value.

Parameters
[in]new_policythe new value of the variable.
Return values
falsesuccess
truefailure

◆ validate()

bool authentication_policy::Policy::validate ( const char *  new_policy)
protected

Validate @authentication_policy variable value.

Parameters
[in]new_policythe new value of the variable.
Return values
falsesuccess
truefailure

Friends And Related Function Documentation

◆ deinit

void deinit ( )
friend

Component deinitialization.

◆ get_first_factor_default_plugin [1/2]

void get_first_factor_default_plugin ( MEM_ROOT mem_root,
LEX_CSTRING name 
)
friend

Get copy of default plugin name.

Parameters
mem_root[in] place to allocate the name
name[out] copy of the name

◆ get_first_factor_default_plugin [2/2]

void get_first_factor_default_plugin ( std::string &  name)
friend

Get copy of first factor default plugin name.

Parameters
name[out] copy of the name

◆ get_policy_factors

void get_policy_factors ( Factors factors)
friend

Get copy of the authentication policy factors.

The aim is to work is with consistent snapshot of the factor avoiding long time locking.

Parameters
factors[out] authentication policy factors

◆ init

int init ( const char *  opt_authentication_policy)
friend

Initialize authentication policy.

Parameters
opt_authentication_policy[in] value of authentication_policy sysvar
Return values
0success
non0 failure;

◆ policy_update

bool policy_update ( const char *  new_policy)
friend

Validate @authentication_policy variable value.

Parameters
[in]new_policythe new value of the variable.
Return values
falsesuccess
truefailure

◆ policy_validate

bool policy_validate ( const char *  new_policy)
friend

Validate @authentication_policy variable value.

Parameters
[in]new_policythe new value of the variable.
Return values
falsesuccess
truefailure

Member Data Documentation

◆ factors

Factors authentication_policy::Policy::factors
private

Actual authentication policy factors.

◆ new_factors

Factors authentication_policy::Policy::new_factors
private

Verified, but not yet set authentication policy factors.

Set in validate(), replace actual factors in update(). Used to avoid second validation in update().

◆ plugin_refs

std::vector<plugin_ref> authentication_policy::Policy::plugin_refs
private

◆ policy

Policy * authentication_policy::Policy::policy
staticprotected

Pointer to the authentication policy object.

◆ verified_policy_value

std::string authentication_policy::Policy::verified_policy_value
private

The verified policy value.

Used to ensure the following validate() and update() work with the same value.


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