MySQL 9.1.0
Source Code Documentation
Rewriter_user Class Referenceabstract

Abstract base class to define the skeleton of rewriting the users, yet deferring some steps to the concrete classes. More...

#include <sql_rewrite.h>

Inheritance diagram for Rewriter_user:
[legend]

Protected Member Functions

 Rewriter_user (THD *thd, Consumer_type target_type)
 
void rewrite_users (LEX *lex, String *str) const
 Fetch the users from user_list in LEX struct and append them to the String. More...
 
void append_literal_secret (String *str) const
 Append the literal <secret> in place of password to the output string. More...
 
virtual void append_auth_str (LEX_USER *lex, String *str) const
 Append the password hash to the output string. More...
 
void append_plugin_name (const LEX_USER *user, String *str) const
 Append the authentication plugin name for the user. More...
 
void append_mfa_plugin_name (const LEX_MFA *user, String *str) const
 Append the authentication plugin name from LEX_MFA for the user. More...
 
void append_mfa_auth_str (const LEX_MFA *user, String *str) const
 Append the authentication string from LEX_MFA for the user. More...
 
bool rewrite (String &rlb) const override
 Appends the essential clauses for SHOW CREATE|CREATE|ALTER USER statements in the buffer rlb. More...
 
virtual void append_user_auth_info (LEX_USER *user, bool comma, String *str) const =0
 
virtual void rewrite_password_history (const LEX *lex, String *str) const =0
 The default implementation is to append the PASSWORD HISTORY clause iff it is specified. More...
 
virtual void rewrite_password_reuse (const LEX *lex, String *str) const =0
 The default implementation is to append the PASSWORD REUSE clause iff it is specified. More...
 
virtual void rewrite_user_application_user_metadata (const LEX *lex, String *str) const =0
 
void rewrite_in_memory_user_application_user_metadata (const LEX *user, String *str) const
 Use the LEX for reconstructing the ATTRIBUTE or COMMENT clause. More...
 

Private Member Functions

void rewrite_ssl_properties (const LEX *lex, String *str) const
 Append the SSL clause for users iff it is specified. More...
 
void rewrite_user_resources (const LEX *lex, String *str) const
 Append the user resource clauses for users. More...
 
void rewrite_account_lock (const LEX *lex, String *str) const
 Append the ACCOUNT LOCK clause for users iff it is specified. More...
 
void rewrite_password_expired (const LEX *lex, String *str) const
 Append the PASSWORD EXPIRE clause for users iff it is specified. More...
 
void rewrite_password_require_current (LEX *lex, String *str) const
 Append the PASSWORD REQUIRE CURRENT clause for users. More...
 
void rewrite_account_lock_state (LEX *lex, String *str) const
 Append the account lock state. More...
 
void rewrite_default_roles (const LEX *lex, String *str) const
 Append the DEFAULT ROLE clause for users iff it is specified. More...
 

Additional Inherited Members

- Public Member Functions inherited from I_rewriter
 I_rewriter (THD *thd, Consumer_type type)
 
virtual ~I_rewriter ()
 
 I_rewriter (const I_rewriter &)=delete
 
const I_rewriteroperator= (const I_rewriter &)=delete
 
 I_rewriter (const I_rewriter &&)=delete
 
const I_rewriteroperator= (const I_rewriter &&)=delete
 
void set_consumer_type (Consumer_type type)
 Reset the previous consumer type. More...
 
Consumer_type consumer_type ()
 Return the current consumer type set in the object. More...
 
- Protected Attributes inherited from I_rewriter
THD *const m_thd
 
Consumer_type m_consumer_type
 

Detailed Description

Abstract base class to define the skeleton of rewriting the users, yet deferring some steps to the concrete classes.

The implementation in specific steps might vary according to SQL or the consumer type.

Constructor & Destructor Documentation

◆ Rewriter_user()

Rewriter_user::Rewriter_user ( THD thd,
Consumer_type  target_type 
)
protected

Member Function Documentation

◆ append_auth_str()

void Rewriter_user::append_auth_str ( LEX_USER user,
String str 
) const
protectedvirtual

Append the password hash to the output string.

Parameters
[in]userLEX_USER to fetch the auth string of it.
[in,out]strThe string in which hash value is suffixed

Reimplemented in Rewriter_show_create_user.

◆ append_literal_secret()

void Rewriter_user::append_literal_secret ( String str) const
protected

Append the literal <secret> in place of password to the output string.

Parameters
[in,out]strThe string in which literal value is suffixed

◆ append_mfa_auth_str()

void Rewriter_user::append_mfa_auth_str ( const LEX_MFA user,
String str 
) const
protected

Append the authentication string from LEX_MFA for the user.

Parameters
[in]userUser to retrieve the plugin string
[in,out]strThe string in which plugin info is suffixed

◆ append_mfa_plugin_name()

void Rewriter_user::append_mfa_plugin_name ( const LEX_MFA user,
String str 
) const
protected

Append the authentication plugin name from LEX_MFA for the user.

Parameters
[in]userUser to retrieve the plugin string
[in,out]strThe string in which plugin info is suffixed

◆ append_plugin_name()

void Rewriter_user::append_plugin_name ( const LEX_USER user,
String str 
) const
protected

Append the authentication plugin name for the user.

Parameters
[in]userLEX User to retrieve the plugin string
[in,out]strThe string in which plugin info is suffixed

◆ append_user_auth_info()

virtual void Rewriter_user::append_user_auth_info ( LEX_USER user,
bool  comma,
String str 
) const
protectedpure virtual

◆ rewrite()

bool Rewriter_user::rewrite ( String rlb) const
overrideprotectedvirtual

Appends the essential clauses for SHOW CREATE|CREATE|ALTER USER statements in the buffer rlb.

Parameters
[in,out]rlbBuffer to return the rewritten query in.
Return values
falseSince it does the partial query rewrite. Must be called through derived classes rewrite().

Implements I_rewriter.

Reimplemented in Rewriter_create_user, Rewriter_alter_user, and Rewriter_show_create_user.

◆ rewrite_account_lock()

void Rewriter_user::rewrite_account_lock ( const LEX lex,
String str 
) const
private

Append the ACCOUNT LOCK clause for users iff it is specified.

Parameters
[in]lexLEX struct to check if clause is specified
[in,out]strThe string in which clause is suffixed

◆ rewrite_account_lock_state()

void Rewriter_user::rewrite_account_lock_state ( LEX lex,
String str 
) const
private

Append the account lock state.

Append FAILED_LOGIN_ATTEMPTS/PASSWORD_LOCK_TIME if account auto-lock is active.

Parameters
[in]lexLEX to retrieve data from
[in,out]strThe string in which plugin info is suffixed

◆ rewrite_default_roles()

void Rewriter_user::rewrite_default_roles ( const LEX lex,
String str 
) const
private

Append the DEFAULT ROLE clause for users iff it is specified.

Parameters
[in]lexLEX struct to check if clause is specified
[in,out]strThe string in which clause is suffixed

◆ rewrite_in_memory_user_application_user_metadata()

void Rewriter_user::rewrite_in_memory_user_application_user_metadata ( const LEX lex,
String str 
) const
protected

Use the LEX for reconstructing the ATTRIBUTE or COMMENT clause.

Parameters
[in]lexLEX struct to know if the clause was specified
[in,out]strThe string in which the clause is suffixed

◆ rewrite_password_expired()

void Rewriter_user::rewrite_password_expired ( const LEX lex,
String str 
) const
private

Append the PASSWORD EXPIRE clause for users iff it is specified.

Parameters
[in]lexLEX struct to check if clause is specified
[in,out]strThe string in which clause is suffixed

◆ rewrite_password_history()

void Rewriter_user::rewrite_password_history ( const LEX lex,
String str 
) const
protectedpure virtual

The default implementation is to append the PASSWORD HISTORY clause iff it is specified.

Though concrete classes may add their own implementation.

Parameters
[in]lexLEX struct to check if clause is specified
[in,out]strThe string in which clause is suffixed

Implemented in Rewriter_create_user, Rewriter_alter_user, and Rewriter_show_create_user.

◆ rewrite_password_require_current()

void Rewriter_user::rewrite_password_require_current ( LEX lex,
String str 
) const
private

Append the PASSWORD REQUIRE CURRENT clause for users.

Parameters
[in]lexLEX struct to know if the clause was specified
[in,out]strThe string in which the clause is suffixed

◆ rewrite_password_reuse()

void Rewriter_user::rewrite_password_reuse ( const LEX lex,
String str 
) const
protectedpure virtual

The default implementation is to append the PASSWORD REUSE clause iff it is specified.

Though concrete classes may add their own implementation.

Parameters
[in]lexLEX struct to check if clause is specified
[in,out]strThe string in which clause is suffixed

Implemented in Rewriter_create_user, Rewriter_alter_user, and Rewriter_show_create_user.

◆ rewrite_ssl_properties()

void Rewriter_user::rewrite_ssl_properties ( const LEX lex,
String str 
) const
private

Append the SSL clause for users iff it is specified.

Parameters
[in]lexLEX struct to check if clause is specified
[in,out]strThe string in which clause is suffixed

◆ rewrite_user_application_user_metadata()

virtual void Rewriter_user::rewrite_user_application_user_metadata ( const LEX lex,
String str 
) const
protectedpure virtual

◆ rewrite_user_resources()

void Rewriter_user::rewrite_user_resources ( const LEX lex,
String str 
) const
private

Append the user resource clauses for users.

Parameters
[in]lexLEX struct to check if clause is specified
[in,out]strThe string in which clause is suffixed

◆ rewrite_users()

void Rewriter_user::rewrite_users ( LEX lex,
String str 
) const
protected

Fetch the users from user_list in LEX struct and append them to the String.

Parameters
[in]lexLEX struct to check if clause is specified
[in,out]strThe string in which clause is suffixed

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