Skip to content

Commit 0f06c02

Browse files
author
Grzegorz Szwarc
committed
WL#9271: Mysqlx authentication of users using SHA256-auth-plugin
X Plugin has implemented two types of authentication: "plain" and "mysql41". Both types use 'mysql_native_password' plugin entries in `mysql`.`user` table (MySQL Server account types). This worklog is about supporting MySQL Server accounts that use 'sha256_password' plugin. Approved-by: Mohit Joshi <[email protected]>
1 parent 0f86a5f commit 0f06c02

File tree

100 files changed

+6356
-3565
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+6356
-3565
lines changed

rapid/plugin/x/ngs/include/ngs/client.h

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -53,32 +53,42 @@ namespace ngs
5353
ngs::shared_ptr<Session_interface> session() { return m_session; }
5454

5555
public: // impl ngs::Client_interface
56-
virtual void run(const bool skip_resolve_name);
56+
void run(const bool skip_resolve_name) override;
5757

58-
virtual void activate_tls();
58+
void activate_tls() override;
5959

60-
virtual void reset_accept_time();
60+
void reset_accept_time() override;
6161

62-
virtual void on_auth_timeout();
63-
virtual void on_server_shutdown();
62+
void on_auth_timeout() override;
63+
void on_server_shutdown() override;
6464

65-
virtual Server_interface &server() const { return m_server; }
66-
virtual Connection_vio &connection() { return *m_connection; };
65+
Server_interface &server() const override { return m_server; }
66+
Connection_vio &connection() override { return *m_connection; };
6767

68-
virtual void on_session_auth_success(Session_interface &s);
69-
virtual void on_session_close(Session_interface &s);
70-
virtual void on_session_reset(Session_interface &s);
68+
void on_session_auth_success(Session_interface &s) override;
69+
void on_session_close(Session_interface &s) override;
70+
void on_session_reset(Session_interface &s) override;
7171

72-
virtual void disconnect_and_trigger_close();
72+
void disconnect_and_trigger_close() override;
7373

74-
virtual const char *client_address() const { return m_client_addr.c_str(); }
75-
virtual const char *client_hostname() const { return m_client_host.c_str(); }
76-
virtual const char *client_id() const { return m_id; }
77-
virtual Client_id client_id_num() const { return m_client_id; }
78-
virtual int client_port() const { return m_client_port; }
74+
const char *client_address() const override { return m_client_addr.c_str(); }
75+
const char *client_hostname() const override { return m_client_host.c_str(); }
76+
const char *client_id() const override { return m_id; }
77+
Client_id client_id_num() const override { return m_client_id; }
78+
int client_port() const override { return m_client_port; }
7979

80-
virtual Client_state get_state() const { return m_state.load(); };
81-
virtual chrono::time_point get_accept_time() const;
80+
Client_state get_state() const override { return m_state.load(); };
81+
chrono::time_point get_accept_time() const override;
82+
83+
void set_supports_expired_passwords(bool flag)
84+
{
85+
m_supports_expired_passwords = flag;
86+
}
87+
88+
bool supports_expired_passwords() const override
89+
{
90+
return m_supports_expired_passwords;
91+
}
8292

8393
protected:
8494
char m_id[2+sizeof(Client_id)*2+1]; // 64bits in hex, plus 0x plus \0
@@ -114,6 +124,7 @@ namespace ngs
114124

115125
char* m_msg_buffer;
116126
size_t m_msg_buffer_size;
127+
bool m_supports_expired_passwords;
117128

118129
Request *read_one_message(Error_code &ret_error);
119130

rapid/plugin/x/ngs/include/ngs/client_session.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222

2323
#include <assert.h>
2424

25+
#include "interface/authentication_interface.h"
2526
#include "interface/session_interface.h"
2627
#include "my_inttypes.h"
27-
#include "ngs/protocol_authentication.h"
2828
#include "ngs/protocol_encoder.h"
2929
#include "ngs/thread.h"
3030

@@ -47,8 +47,8 @@ namespace ngs
4747
public:
4848
virtual void on_close(const bool update_old_state = false);
4949
virtual void on_kill();
50-
virtual void on_auth_success(const Authentication_handler::Response &response);
51-
virtual void on_auth_failure(const Authentication_handler::Response &response);
50+
virtual void on_auth_success(const Authentication_interface::Response &response);
51+
virtual void on_auth_failure(const Authentication_interface::Response &response);
5252

5353
// handle a single message, returns true if message was handled false if not
5454
virtual bool handle_message(ngs::Request &command);
@@ -70,7 +70,7 @@ namespace ngs
7070
protected:
7171
Client_interface &m_client;
7272
Protocol_encoder *m_encoder;
73-
Authentication_handler_ptr m_auth_handler;
73+
Authentication_interface_ptr m_auth_handler;
7474
State m_state;
7575
State m_state_before_close;
7676

0 commit comments

Comments
 (0)