This is an automated email from the ASF dual-hosted git repository.

zhaojinchao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new cb4c4e82919 For #25856, update MySQL protocol javadoc. (#25918)
cb4c4e82919 is described below

commit cb4c4e82919f4990932d40fd0f4a914413f2a152
Author: Raigor <[email protected]>
AuthorDate: Sun May 28 09:25:37 2023 +0800

    For #25856, update MySQL protocol javadoc. (#25918)
    
    * For #25856, update MySQL protocol javadoc.
    
    * Rename enum.
---
 .../db/protocol/mysql/constant/MySQLAuthenticationPlugin.java      | 6 +++---
 .../data/pipeline/mysql/ingest/client/PasswordEncryption.java      | 7 +++----
 .../pipeline/mysql/ingest/client/netty/MySQLNegotiateHandler.java  | 5 ++---
 3 files changed, 8 insertions(+), 10 deletions(-)

diff --git 
a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLAuthenticationPlugin.java
 
b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLAuthenticationPlugin.java
index 13af13af3e4..14bef7dfae7 100644
--- 
a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLAuthenticationPlugin.java
+++ 
b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLAuthenticationPlugin.java
@@ -34,11 +34,11 @@ public enum MySQLAuthenticationPlugin {
     
     DEFAULT(null),
     
-    NATIVE_PASSWORD_AUTHENTICATION("mysql_native_password"),
+    NATIVE("mysql_native_password"),
     
-    SHA2_AUTHENTICATION("caching_sha2_password"),
+    CACHING_SHA2("caching_sha2_password"),
     
-    SHA256_AUTHENTICATION("sha256_password");
+    SHA256("sha256_password");
     
     private static final Map<String, MySQLAuthenticationPlugin> 
VALUE_AND_COLUMN_TYPE_MAP = new HashMap<>(values().length, 1F);
     
diff --git 
a/kernel/data-pipeline/dialect/mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/client/PasswordEncryption.java
 
b/kernel/data-pipeline/dialect/mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/client/PasswordEncryption.java
index 29eb06c86ea..ef3ac6086b7 100644
--- 
a/kernel/data-pipeline/dialect/mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/client/PasswordEncryption.java
+++ 
b/kernel/data-pipeline/dialect/mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/client/PasswordEncryption.java
@@ -40,10 +40,7 @@ public final class PasswordEncryption {
     /**
      * Encrypt password with MySQL protocol 41.
      *
-     * <p>
-     * MySQL Internals Manual  /  MySQL Client/Server Protocol  /  
Authentication Method  /  Secure Password Authentication
-     * <a 
href="https://dev.mysql.com/doc/internals/en/secure-password-authentication.html";>secure-password-authentication</a>
-     * </p>
+     * @see <a 
href="https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_connection_phase_authentication_methods_native_password_authentication.html";>Native
 Authentication</a>
      *
      * @param password password
      * @param seed 20-bytes random data from server
@@ -60,6 +57,8 @@ public final class PasswordEncryption {
     /**
      * Encrypt password with sha2.
      *
+     * @see <a 
href="https://dev.mysql.com/doc/dev/mysql-server/latest/page_caching_sha2_authentication_exchanges.html";>Caching_sha2_password
 information</a>
+     * 
      * @param password password
      * @param seed 20-bytes random data from server
      * @return encrypted password
diff --git 
a/kernel/data-pipeline/dialect/mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/client/netty/MySQLNegotiateHandler.java
 
b/kernel/data-pipeline/dialect/mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/client/netty/MySQLNegotiateHandler.java
index dac69084ae8..edcbbbdeb52 100644
--- 
a/kernel/data-pipeline/dialect/mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/client/netty/MySQLNegotiateHandler.java
+++ 
b/kernel/data-pipeline/dialect/mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/client/netty/MySQLNegotiateHandler.java
@@ -102,9 +102,9 @@ public final class MySQLNegotiateHandler extends 
ChannelInboundHandlerAdapter {
     private byte[] getAuthPluginResponse(final MySQLAuthSwitchRequestPacket 
authSwitchRequest) throws NoSuchAlgorithmException {
         // TODO not support sha256_password now
         switch 
(MySQLAuthenticationPlugin.getPluginByName(authSwitchRequest.getAuthPluginName()))
 {
-            case NATIVE_PASSWORD_AUTHENTICATION:
+            case NATIVE:
                 return 
PasswordEncryption.encryptWithMySQL41(password.getBytes(), 
authSwitchRequest.getAuthPluginData().getAuthenticationPluginData());
-            case SHA2_AUTHENTICATION:
+            case CACHING_SHA2:
                 return PasswordEncryption.encryptWithSha2(password.getBytes(), 
authSwitchRequest.getAuthPluginData().getAuthenticationPluginData());
             default:
                 return password.getBytes();
@@ -112,7 +112,6 @@ public final class MySQLNegotiateHandler extends 
ChannelInboundHandlerAdapter {
     }
     
     private void handleCachingSha2Auth(final ChannelHandlerContext ctx, final 
MySQLAuthMoreDataPacket authMoreData) {
-        // how caching_sha2_password works: 
https://dev.mysql.com/doc/dev/mysql-server/8.0.11/page_caching_sha2_authentication_exchanges.html#sect_caching_sha2_info
         if (publicKeyRequested) {
             ctx.channel().writeAndFlush(new MySQLAuthSwitchResponsePacket(
                     PasswordEncryption.encryptWithRSAPublicKey(password, seed,

Reply via email to