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

jianglongtao 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 29a6dc98e2c Move Authenticator to authority module (#30074)
29a6dc98e2c is described below

commit 29a6dc98e2c410f75fa48bf0dd542fcd0c60097d
Author: Liang Zhang <[email protected]>
AuthorDate: Thu Feb 8 16:05:15 2024 +0800

    Move Authenticator to authority module (#30074)
    
    * Refactor Authenticator.getAuthenticationMethodName()
    
    * Move Authenticator to authority module
    
    * Move Authenticator to authority module
---
 .../apache/shardingsphere}/authentication/Authenticator.java |  9 ++++-----
 .../shardingsphere}/authentication/AuthenticatorFactory.java |  2 +-
 .../shardingsphere}/authentication/AuthenticatorType.java    |  2 +-
 .../authentication/result}/AuthenticationResult.java         |  2 +-
 .../authentication/result}/AuthenticationResultBuilder.java  |  2 +-
 .../apache/shardingsphere/authority/rule/AuthorityRule.java  | 10 +++++++---
 .../result}/AuthenticationResultBuilderTest.java             |  4 ++--
 .../proxy/frontend/netty/FrontendChannelInboundHandler.java  |  2 +-
 .../frontend/netty/FrontendChannelInboundHandlerTest.java    |  4 ++--
 .../proxy/frontend/authentication/AuthenticationEngine.java  |  1 +
 .../mysql/authentication/MySQLAuthenticationEngine.java      | 12 ++++++------
 .../authentication/authenticator/MySQLAuthenticator.java     |  2 +-
 .../authentication/authenticator/MySQLAuthenticatorType.java |  2 +-
 .../authenticator/impl/MySQLClearPasswordAuthenticator.java  |  5 ++---
 .../authenticator/impl/MySQLNativePasswordAuthenticator.java |  5 ++---
 .../mysql/authentication/MySQLAuthenticationEngineTest.java  |  6 +++---
 .../authenticator/MySQLAuthenticatorTypeTest.java            |  6 +++---
 .../impl/MySQLClearPasswordAuthenticatorTest.java            |  2 +-
 .../authentication/OpenGaussAuthenticationEngine.java        | 12 ++++++------
 .../authentication/authenticator/OpenGaussAuthenticator.java |  2 +-
 .../authenticator/OpenGaussAuthenticatorType.java            |  2 +-
 .../impl/OpenGaussMD5PasswordAuthenticator.java              |  5 ++---
 .../impl/OpenGaussSCRAMSha256PasswordAuthenticator.java      |  5 ++---
 .../authentication/OpenGaussAuthenticationEngineTest.java    |  2 +-
 .../authenticator/OpenGaussAuthenticatorTypeTest.java        |  6 +++---
 .../impl/OpenGaussMD5PasswordAuthenticatorTest.java          |  2 +-
 .../authentication/PostgreSQLAuthenticationEngine.java       | 10 +++++-----
 .../authenticator/PostgreSQLAuthenticator.java               |  2 +-
 .../authenticator/PostgreSQLAuthenticatorType.java           |  2 +-
 .../impl/PostgreSQLMD5PasswordAuthenticator.java             |  5 ++---
 .../authenticator/impl/PostgreSQLPasswordAuthenticator.java  |  5 ++---
 .../authentication/PostgreSQLAuthenticationEngineTest.java   |  2 +-
 .../authenticator/PostgreSQLAuthenticatorTypeTest.java       |  6 +++---
 .../impl/PostgreSQLMD5PasswordAuthenticatorTest.java         |  2 +-
 .../impl/PostgreSQLPasswordAuthenticatorTest.java            |  2 +-
 35 files changed, 74 insertions(+), 76 deletions(-)

diff --git 
a/proxy/frontend/spi/src/main/java/org/apache/shardingsphere/proxy/frontend/authentication/Authenticator.java
 
b/kernel/authority/core/src/main/java/org/apache/shardingsphere/authentication/Authenticator.java
similarity index 82%
rename from 
proxy/frontend/spi/src/main/java/org/apache/shardingsphere/proxy/frontend/authentication/Authenticator.java
rename to 
kernel/authority/core/src/main/java/org/apache/shardingsphere/authentication/Authenticator.java
index c4923e6f445..a01f08a3397 100644
--- 
a/proxy/frontend/spi/src/main/java/org/apache/shardingsphere/proxy/frontend/authentication/Authenticator.java
+++ 
b/kernel/authority/core/src/main/java/org/apache/shardingsphere/authentication/Authenticator.java
@@ -15,9 +15,8 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.proxy.frontend.authentication;
+package org.apache.shardingsphere.authentication;
 
-import org.apache.shardingsphere.db.protocol.constant.AuthenticationMethod;
 import org.apache.shardingsphere.infra.metadata.user.ShardingSphereUser;
 
 /**
@@ -35,9 +34,9 @@ public interface Authenticator {
     boolean authenticate(ShardingSphereUser user, Object[] authInfo);
     
     /**
-     * Get authentication method.
+     * Get authentication method name.
      *
-     * @return authentication method
+     * @return authentication method name
      */
-    AuthenticationMethod getAuthenticationMethod();
+    String getAuthenticationMethodName();
 }
diff --git 
a/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/authentication/AuthenticatorFactory.java
 
b/kernel/authority/core/src/main/java/org/apache/shardingsphere/authentication/AuthenticatorFactory.java
similarity index 97%
rename from 
proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/authentication/AuthenticatorFactory.java
rename to 
kernel/authority/core/src/main/java/org/apache/shardingsphere/authentication/AuthenticatorFactory.java
index 620952d01f8..552806d2583 100644
--- 
a/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/authentication/AuthenticatorFactory.java
+++ 
b/kernel/authority/core/src/main/java/org/apache/shardingsphere/authentication/AuthenticatorFactory.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.proxy.frontend.authentication;
+package org.apache.shardingsphere.authentication;
 
 import lombok.RequiredArgsConstructor;
 import lombok.SneakyThrows;
diff --git 
a/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/authentication/AuthenticatorType.java
 
b/kernel/authority/core/src/main/java/org/apache/shardingsphere/authentication/AuthenticatorType.java
similarity index 94%
rename from 
proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/authentication/AuthenticatorType.java
rename to 
kernel/authority/core/src/main/java/org/apache/shardingsphere/authentication/AuthenticatorType.java
index 739b4881bf2..4174674de83 100644
--- 
a/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/authentication/AuthenticatorType.java
+++ 
b/kernel/authority/core/src/main/java/org/apache/shardingsphere/authentication/AuthenticatorType.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.proxy.frontend.authentication;
+package org.apache.shardingsphere.authentication;
 
 /**
  * Authenticator type.
diff --git 
a/proxy/frontend/spi/src/main/java/org/apache/shardingsphere/proxy/frontend/authentication/AuthenticationResult.java
 
b/kernel/authority/core/src/main/java/org/apache/shardingsphere/authentication/result/AuthenticationResult.java
similarity index 94%
rename from 
proxy/frontend/spi/src/main/java/org/apache/shardingsphere/proxy/frontend/authentication/AuthenticationResult.java
rename to 
kernel/authority/core/src/main/java/org/apache/shardingsphere/authentication/result/AuthenticationResult.java
index db4edc31aa5..c860ef2ece0 100644
--- 
a/proxy/frontend/spi/src/main/java/org/apache/shardingsphere/proxy/frontend/authentication/AuthenticationResult.java
+++ 
b/kernel/authority/core/src/main/java/org/apache/shardingsphere/authentication/result/AuthenticationResult.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.proxy.frontend.authentication;
+package org.apache.shardingsphere.authentication.result;
 
 import lombok.Getter;
 import lombok.RequiredArgsConstructor;
diff --git 
a/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/authentication/AuthenticationResultBuilder.java
 
b/kernel/authority/core/src/main/java/org/apache/shardingsphere/authentication/result/AuthenticationResultBuilder.java
similarity index 96%
rename from 
proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/authentication/AuthenticationResultBuilder.java
rename to 
kernel/authority/core/src/main/java/org/apache/shardingsphere/authentication/result/AuthenticationResultBuilder.java
index d0aafe83bef..086604365ad 100644
--- 
a/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/authentication/AuthenticationResultBuilder.java
+++ 
b/kernel/authority/core/src/main/java/org/apache/shardingsphere/authentication/result/AuthenticationResultBuilder.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.proxy.frontend.authentication;
+package org.apache.shardingsphere.authentication.result;
 
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
diff --git 
a/kernel/authority/core/src/main/java/org/apache/shardingsphere/authority/rule/AuthorityRule.java
 
b/kernel/authority/core/src/main/java/org/apache/shardingsphere/authority/rule/AuthorityRule.java
index 30efd1bcc11..419dfe8ba77 100644
--- 
a/kernel/authority/core/src/main/java/org/apache/shardingsphere/authority/rule/AuthorityRule.java
+++ 
b/kernel/authority/core/src/main/java/org/apache/shardingsphere/authority/rule/AuthorityRule.java
@@ -52,9 +52,13 @@ public final class AuthorityRule implements GlobalRule {
      * @return authenticator type
      */
     public String getAuthenticatorType(final ShardingSphereUser user) {
-        return 
configuration.getAuthenticators().containsKey(user.getAuthenticationMethodName())
-                ? 
configuration.getAuthenticators().get(user.getAuthenticationMethodName()).getType()
-                : 
Optional.ofNullable(configuration.getAuthenticators().get(configuration.getDefaultAuthenticator()).getType()).orElse("");
+        if 
(configuration.getAuthenticators().containsKey(user.getAuthenticationMethodName()))
 {
+            return 
configuration.getAuthenticators().get(user.getAuthenticationMethodName()).getType();
+        }
+        if 
(configuration.getAuthenticators().containsKey(configuration.getDefaultAuthenticator()))
 {
+            return 
configuration.getAuthenticators().get(configuration.getDefaultAuthenticator()).getType();
+        }
+        return "";
     }
     
     /**
diff --git 
a/proxy/frontend/core/src/test/java/org/apache/shardingsphere/proxy/frontend/authentication/AuthenticationResultBuilderTest.java
 
b/kernel/authority/core/src/test/java/org/apache/shardingsphere/authentication/result/AuthenticationResultBuilderTest.java
similarity index 97%
rename from 
proxy/frontend/core/src/test/java/org/apache/shardingsphere/proxy/frontend/authentication/AuthenticationResultBuilderTest.java
rename to 
kernel/authority/core/src/test/java/org/apache/shardingsphere/authentication/result/AuthenticationResultBuilderTest.java
index 76eb43c4c71..ee8397e351c 100644
--- 
a/proxy/frontend/core/src/test/java/org/apache/shardingsphere/proxy/frontend/authentication/AuthenticationResultBuilderTest.java
+++ 
b/kernel/authority/core/src/test/java/org/apache/shardingsphere/authentication/result/AuthenticationResultBuilderTest.java
@@ -15,14 +15,14 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.proxy.frontend.authentication;
+package org.apache.shardingsphere.authentication.result;
 
 import org.junit.jupiter.api.Test;
 
 import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
 import static org.junit.jupiter.api.Assertions.assertFalse;
 import static org.junit.jupiter.api.Assertions.assertNull;
-import static org.hamcrest.MatcherAssert.assertThat;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
 class AuthenticationResultBuilderTest {
diff --git 
a/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/netty/FrontendChannelInboundHandler.java
 
b/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/netty/FrontendChannelInboundHandler.java
index 000bd3505d6..ed57d6e3c5a 100644
--- 
a/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/netty/FrontendChannelInboundHandler.java
+++ 
b/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/netty/FrontendChannelInboundHandler.java
@@ -27,7 +27,7 @@ import 
org.apache.shardingsphere.infra.executor.sql.process.ProcessEngine;
 import org.apache.shardingsphere.infra.metadata.user.Grantee;
 import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
 import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
-import 
org.apache.shardingsphere.proxy.frontend.authentication.AuthenticationResult;
+import org.apache.shardingsphere.authentication.result.AuthenticationResult;
 import org.apache.shardingsphere.proxy.frontend.exception.ExpectedExceptions;
 import 
org.apache.shardingsphere.proxy.frontend.executor.ConnectionThreadExecutorGroup;
 import org.apache.shardingsphere.proxy.frontend.executor.UserExecutorGroup;
diff --git 
a/proxy/frontend/core/src/test/java/org/apache/shardingsphere/proxy/frontend/netty/FrontendChannelInboundHandlerTest.java
 
b/proxy/frontend/core/src/test/java/org/apache/shardingsphere/proxy/frontend/netty/FrontendChannelInboundHandlerTest.java
index f797ad2e055..5542d9c79b3 100644
--- 
a/proxy/frontend/core/src/test/java/org/apache/shardingsphere/proxy/frontend/netty/FrontendChannelInboundHandlerTest.java
+++ 
b/proxy/frontend/core/src/test/java/org/apache/shardingsphere/proxy/frontend/netty/FrontendChannelInboundHandlerTest.java
@@ -31,8 +31,8 @@ import org.apache.shardingsphere.mode.manager.ContextManager;
 import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
 import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
 import 
org.apache.shardingsphere.proxy.frontend.authentication.AuthenticationEngine;
-import 
org.apache.shardingsphere.proxy.frontend.authentication.AuthenticationResult;
-import 
org.apache.shardingsphere.proxy.frontend.authentication.AuthenticationResultBuilder;
+import org.apache.shardingsphere.authentication.result.AuthenticationResult;
+import 
org.apache.shardingsphere.authentication.result.AuthenticationResultBuilder;
 import 
org.apache.shardingsphere.proxy.frontend.spi.DatabaseProtocolFrontendEngine;
 import org.apache.shardingsphere.test.mock.AutoMockExtension;
 import org.apache.shardingsphere.test.mock.StaticMockSettings;
diff --git 
a/proxy/frontend/spi/src/main/java/org/apache/shardingsphere/proxy/frontend/authentication/AuthenticationEngine.java
 
b/proxy/frontend/spi/src/main/java/org/apache/shardingsphere/proxy/frontend/authentication/AuthenticationEngine.java
index 7b3c2917971..f59c03e2969 100644
--- 
a/proxy/frontend/spi/src/main/java/org/apache/shardingsphere/proxy/frontend/authentication/AuthenticationEngine.java
+++ 
b/proxy/frontend/spi/src/main/java/org/apache/shardingsphere/proxy/frontend/authentication/AuthenticationEngine.java
@@ -18,6 +18,7 @@
 package org.apache.shardingsphere.proxy.frontend.authentication;
 
 import io.netty.channel.ChannelHandlerContext;
+import org.apache.shardingsphere.authentication.result.AuthenticationResult;
 import org.apache.shardingsphere.db.protocol.payload.PacketPayload;
 
 /**
diff --git 
a/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationEngine.java
 
b/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationEngine.java
index 31233a864ea..3afb2c1751b 100644
--- 
a/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationEngine.java
+++ 
b/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationEngine.java
@@ -46,10 +46,10 @@ import 
org.apache.shardingsphere.infra.metadata.user.Grantee;
 import org.apache.shardingsphere.infra.metadata.user.ShardingSphereUser;
 import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
 import 
org.apache.shardingsphere.proxy.frontend.authentication.AuthenticationEngine;
-import 
org.apache.shardingsphere.proxy.frontend.authentication.AuthenticationResult;
-import 
org.apache.shardingsphere.proxy.frontend.authentication.AuthenticationResultBuilder;
-import org.apache.shardingsphere.proxy.frontend.authentication.Authenticator;
-import 
org.apache.shardingsphere.proxy.frontend.authentication.AuthenticatorFactory;
+import org.apache.shardingsphere.authentication.result.AuthenticationResult;
+import 
org.apache.shardingsphere.authentication.result.AuthenticationResultBuilder;
+import org.apache.shardingsphere.authentication.Authenticator;
+import org.apache.shardingsphere.authentication.AuthenticatorFactory;
 import 
org.apache.shardingsphere.proxy.frontend.connection.ConnectionIdGenerator;
 import 
org.apache.shardingsphere.proxy.frontend.mysql.authentication.authenticator.MySQLAuthenticatorType;
 import 
org.apache.shardingsphere.proxy.frontend.mysql.command.query.binary.MySQLStatementIdGenerator;
@@ -130,9 +130,9 @@ public final class MySQLAuthenticationEngine implements 
AuthenticationEngine {
         String hostname = getHostAddress(context);
         ShardingSphereUser user = rule.findUser(new Grantee(username, 
hostname)).orElseGet(() -> new ShardingSphereUser(username, "", hostname));
         Authenticator authenticator = new 
AuthenticatorFactory<>(MySQLAuthenticatorType.class, rule).newInstance(user);
-        if (isClientPluginAuthenticate(handshakeResponsePacket) && 
!authenticator.getAuthenticationMethod().getMethodName().equals(handshakeResponsePacket.getAuthPluginName()))
 {
+        if (isClientPluginAuthenticate(handshakeResponsePacket) && 
!authenticator.getAuthenticationMethodName().equals(handshakeResponsePacket.getAuthPluginName()))
 {
             connectionPhase = 
MySQLConnectionPhase.AUTHENTICATION_METHOD_MISMATCH;
-            context.writeAndFlush(new 
MySQLAuthSwitchRequestPacket(authenticator.getAuthenticationMethod().getMethodName(),
 authPluginData));
+            context.writeAndFlush(new 
MySQLAuthSwitchRequestPacket(authenticator.getAuthenticationMethodName(), 
authPluginData));
             return AuthenticationResultBuilder.continued(username, hostname, 
database);
         }
         return AuthenticationResultBuilder.finished(username, hostname, 
database);
diff --git 
a/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/authenticator/MySQLAuthenticator.java
 
b/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/authenticator/MySQLAuthenticator.java
index 9e1940429d3..839fb7c5b99 100644
--- 
a/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/authenticator/MySQLAuthenticator.java
+++ 
b/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/authenticator/MySQLAuthenticator.java
@@ -17,7 +17,7 @@
 
 package 
org.apache.shardingsphere.proxy.frontend.mysql.authentication.authenticator;
 
-import org.apache.shardingsphere.proxy.frontend.authentication.Authenticator;
+import org.apache.shardingsphere.authentication.Authenticator;
 
 /**
  * MySQL authenticator.
diff --git 
a/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/authenticator/MySQLAuthenticatorType.java
 
b/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/authenticator/MySQLAuthenticatorType.java
index 1a3945aee83..a64a5c59dc4 100644
--- 
a/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/authenticator/MySQLAuthenticatorType.java
+++ 
b/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/authenticator/MySQLAuthenticatorType.java
@@ -19,7 +19,7 @@ package 
org.apache.shardingsphere.proxy.frontend.mysql.authentication.authentica
 
 import lombok.Getter;
 import lombok.RequiredArgsConstructor;
-import 
org.apache.shardingsphere.proxy.frontend.authentication.AuthenticatorType;
+import org.apache.shardingsphere.authentication.AuthenticatorType;
 import 
org.apache.shardingsphere.proxy.frontend.mysql.authentication.authenticator.impl.MySQLClearPasswordAuthenticator;
 import 
org.apache.shardingsphere.proxy.frontend.mysql.authentication.authenticator.impl.MySQLNativePasswordAuthenticator;
 
diff --git 
a/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/authenticator/impl/MySQLClearPasswordAuthenticator.java
 
b/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/authenticator/impl/MySQLClearPasswordAuthenticator.java
index f4f58c51caa..07673a87262 100644
--- 
a/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/authenticator/impl/MySQLClearPasswordAuthenticator.java
+++ 
b/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/authenticator/impl/MySQLClearPasswordAuthenticator.java
@@ -18,7 +18,6 @@
 package 
org.apache.shardingsphere.proxy.frontend.mysql.authentication.authenticator.impl;
 
 import com.google.common.base.Strings;
-import org.apache.shardingsphere.db.protocol.constant.AuthenticationMethod;
 import 
org.apache.shardingsphere.db.protocol.mysql.constant.MySQLAuthenticationMethod;
 import org.apache.shardingsphere.infra.metadata.user.ShardingSphereUser;
 import 
org.apache.shardingsphere.proxy.frontend.mysql.authentication.authenticator.MySQLAuthenticator;
@@ -39,7 +38,7 @@ public final class MySQLClearPasswordAuthenticator implements 
MySQLAuthenticator
     }
     
     @Override
-    public AuthenticationMethod getAuthenticationMethod() {
-        return MySQLAuthenticationMethod.CLEAR_TEXT;
+    public String getAuthenticationMethodName() {
+        return MySQLAuthenticationMethod.CLEAR_TEXT.getMethodName();
     }
 }
diff --git 
a/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/authenticator/impl/MySQLNativePasswordAuthenticator.java
 
b/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/authenticator/impl/MySQLNativePasswordAuthenticator.java
index bc59e83f934..14c8b2f6fc7 100644
--- 
a/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/authenticator/impl/MySQLNativePasswordAuthenticator.java
+++ 
b/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/authenticator/impl/MySQLNativePasswordAuthenticator.java
@@ -19,7 +19,6 @@ package 
org.apache.shardingsphere.proxy.frontend.mysql.authentication.authentica
 
 import com.google.common.base.Strings;
 import org.apache.commons.codec.digest.DigestUtils;
-import org.apache.shardingsphere.db.protocol.constant.AuthenticationMethod;
 import 
org.apache.shardingsphere.db.protocol.mysql.constant.MySQLAuthenticationMethod;
 import 
org.apache.shardingsphere.db.protocol.mysql.packet.handshake.MySQLAuthenticationPluginData;
 import org.apache.shardingsphere.infra.metadata.user.ShardingSphereUser;
@@ -60,7 +59,7 @@ public final class MySQLNativePasswordAuthenticator 
implements MySQLAuthenticato
     }
     
     @Override
-    public AuthenticationMethod getAuthenticationMethod() {
-        return MySQLAuthenticationMethod.NATIVE;
+    public String getAuthenticationMethodName() {
+        return MySQLAuthenticationMethod.NATIVE.getMethodName();
     }
 }
diff --git 
a/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationEngineTest.java
 
b/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationEngineTest.java
index 50148519ad6..547c9a3ddaa 100644
--- 
a/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationEngineTest.java
+++ 
b/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationEngineTest.java
@@ -52,9 +52,9 @@ import 
org.apache.shardingsphere.metadata.persist.data.ShardingSphereDataPersist
 import org.apache.shardingsphere.mode.manager.ContextManager;
 import org.apache.shardingsphere.mode.metadata.MetaDataContexts;
 import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import 
org.apache.shardingsphere.proxy.frontend.authentication.AuthenticationResultBuilder;
-import org.apache.shardingsphere.proxy.frontend.authentication.Authenticator;
-import 
org.apache.shardingsphere.proxy.frontend.authentication.AuthenticatorFactory;
+import 
org.apache.shardingsphere.authentication.result.AuthenticationResultBuilder;
+import org.apache.shardingsphere.authentication.Authenticator;
+import org.apache.shardingsphere.authentication.AuthenticatorFactory;
 import 
org.apache.shardingsphere.proxy.frontend.mysql.ssl.MySQLSSLRequestHandler;
 import org.apache.shardingsphere.proxy.frontend.ssl.ProxySSLContext;
 import org.apache.shardingsphere.test.mock.AutoMockExtension;
diff --git 
a/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/authenticator/MySQLAuthenticatorTypeTest.java
 
b/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/authenticator/MySQLAuthenticatorTypeTest.java
index 97f84c02d63..2cc99cb16b2 100644
--- 
a/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/authenticator/MySQLAuthenticatorTypeTest.java
+++ 
b/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/authenticator/MySQLAuthenticatorTypeTest.java
@@ -19,8 +19,8 @@ package 
org.apache.shardingsphere.proxy.frontend.mysql.authentication.authentica
 
 import org.apache.shardingsphere.authority.rule.AuthorityRule;
 import org.apache.shardingsphere.infra.metadata.user.ShardingSphereUser;
-import org.apache.shardingsphere.proxy.frontend.authentication.Authenticator;
-import 
org.apache.shardingsphere.proxy.frontend.authentication.AuthenticatorFactory;
+import org.apache.shardingsphere.authentication.Authenticator;
+import org.apache.shardingsphere.authentication.AuthenticatorFactory;
 import org.junit.jupiter.api.extension.ExtensionContext;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.Arguments;
@@ -44,7 +44,7 @@ class MySQLAuthenticatorTypeTest {
     void assertAuthenticator(final String name, final String 
authenticatorType, final String expectedAuthenticatorMethodName) {
         when(rule.getAuthenticatorType(any())).thenReturn(authenticatorType);
         Authenticator actual = new 
AuthenticatorFactory<>(MySQLAuthenticatorType.class, 
rule).newInstance(mock(ShardingSphereUser.class));
-        assertThat(actual.getAuthenticationMethod().getMethodName(), 
is(expectedAuthenticatorMethodName));
+        assertThat(actual.getAuthenticationMethodName(), 
is(expectedAuthenticatorMethodName));
     }
     
     private static class TestCaseArgumentsProvider implements 
ArgumentsProvider {
diff --git 
a/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/authenticator/impl/MySQLClearPasswordAuthenticatorTest.java
 
b/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/authenticator/impl/MySQLClearPasswordAuthenticatorTest.java
index 2deca27a191..8fdc167c86a 100644
--- 
a/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/authenticator/impl/MySQLClearPasswordAuthenticatorTest.java
+++ 
b/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/authenticator/impl/MySQLClearPasswordAuthenticatorTest.java
@@ -29,7 +29,7 @@ class MySQLClearPasswordAuthenticatorTest {
     
     @Test
     void assertAuthenticationMethodName() {
-        assertThat(new 
MySQLClearPasswordAuthenticator().getAuthenticationMethod().getMethodName(), 
is("mysql_clear_password"));
+        assertThat(new 
MySQLClearPasswordAuthenticator().getAuthenticationMethodName(), 
is("mysql_clear_password"));
     }
     
     @Test
diff --git 
a/proxy/frontend/type/opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/OpenGaussAuthenticationEngine.java
 
b/proxy/frontend/type/opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/OpenGaussAuthenticationEngine.java
index 55ac4973cdc..8506fcda462 100644
--- 
a/proxy/frontend/type/opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/OpenGaussAuthenticationEngine.java
+++ 
b/proxy/frontend/type/opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/OpenGaussAuthenticationEngine.java
@@ -55,10 +55,10 @@ import 
org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
 import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
 import 
org.apache.shardingsphere.proxy.backend.postgresql.handler.admin.executor.variable.charset.PostgreSQLCharacterSets;
 import 
org.apache.shardingsphere.proxy.frontend.authentication.AuthenticationEngine;
-import 
org.apache.shardingsphere.proxy.frontend.authentication.AuthenticationResult;
-import 
org.apache.shardingsphere.proxy.frontend.authentication.AuthenticationResultBuilder;
-import org.apache.shardingsphere.proxy.frontend.authentication.Authenticator;
-import 
org.apache.shardingsphere.proxy.frontend.authentication.AuthenticatorFactory;
+import org.apache.shardingsphere.authentication.result.AuthenticationResult;
+import 
org.apache.shardingsphere.authentication.result.AuthenticationResultBuilder;
+import org.apache.shardingsphere.authentication.Authenticator;
+import org.apache.shardingsphere.authentication.AuthenticatorFactory;
 import 
org.apache.shardingsphere.proxy.frontend.connection.ConnectionIdGenerator;
 import 
org.apache.shardingsphere.proxy.frontend.opengauss.authentication.authenticator.OpenGaussAuthenticatorType;
 import org.apache.shardingsphere.proxy.frontend.ssl.ProxySSLContext;
@@ -143,7 +143,7 @@ public final class OpenGaussAuthenticationEngine implements 
AuthenticationEngine
     }
     
     private boolean login(final Authenticator authenticator, final 
ShardingSphereUser user, final String digest) {
-        if (PostgreSQLAuthenticationMethod.MD5 == 
authenticator.getAuthenticationMethod()) {
+        if 
(PostgreSQLAuthenticationMethod.MD5.getMethodName().equals(authenticator.getAuthenticationMethodName()))
 {
             return authenticator.authenticate(user, new Object[]{digest, 
md5Salt});
         }
         return authenticator.authenticate(user, new Object[]{digest, 
authHexData.getSalt(), authHexData.getNonce(), serverIteration});
@@ -163,7 +163,7 @@ public final class OpenGaussAuthenticationEngine implements 
AuthenticationEngine
     
     private PostgreSQLIdentifierPacket getIdentifierPacket(final String 
username, final AuthorityRule rule, final int version) {
         Optional<Authenticator> authenticator = rule.findUser(new 
Grantee(username, "")).map(optional -> new 
AuthenticatorFactory<>(OpenGaussAuthenticatorType.class, 
rule).newInstance(optional));
-        if (authenticator.isPresent() && PostgreSQLAuthenticationMethod.MD5 == 
authenticator.get().getAuthenticationMethod()) {
+        if (authenticator.isPresent() && 
PostgreSQLAuthenticationMethod.MD5.getMethodName().equals(authenticator.get().getAuthenticationMethodName()))
 {
             md5Salt = 
PostgreSQLRandomGenerator.getInstance().generateRandomBytes(4);
             return new PostgreSQLMD5PasswordAuthenticationPacket(md5Salt);
         }
diff --git 
a/proxy/frontend/type/opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/authenticator/OpenGaussAuthenticator.java
 
b/proxy/frontend/type/opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/authenticator/OpenGaussAuthenticator.java
index 4b3ceedea11..0f4c4ad6084 100644
--- 
a/proxy/frontend/type/opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/authenticator/OpenGaussAuthenticator.java
+++ 
b/proxy/frontend/type/opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/authenticator/OpenGaussAuthenticator.java
@@ -17,7 +17,7 @@
 
 package 
org.apache.shardingsphere.proxy.frontend.opengauss.authentication.authenticator;
 
-import org.apache.shardingsphere.proxy.frontend.authentication.Authenticator;
+import org.apache.shardingsphere.authentication.Authenticator;
 
 /**
  * OpenGauss authenticator.
diff --git 
a/proxy/frontend/type/opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/authenticator/OpenGaussAuthenticatorType.java
 
b/proxy/frontend/type/opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/authenticator/OpenGaussAuthenticatorType.java
index 14212556429..059d8c20ac5 100644
--- 
a/proxy/frontend/type/opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/authenticator/OpenGaussAuthenticatorType.java
+++ 
b/proxy/frontend/type/opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/authenticator/OpenGaussAuthenticatorType.java
@@ -19,7 +19,7 @@ package 
org.apache.shardingsphere.proxy.frontend.opengauss.authentication.authen
 
 import lombok.Getter;
 import lombok.RequiredArgsConstructor;
-import 
org.apache.shardingsphere.proxy.frontend.authentication.AuthenticatorType;
+import org.apache.shardingsphere.authentication.AuthenticatorType;
 import 
org.apache.shardingsphere.proxy.frontend.opengauss.authentication.authenticator.impl.OpenGaussMD5PasswordAuthenticator;
 import 
org.apache.shardingsphere.proxy.frontend.opengauss.authentication.authenticator.impl.OpenGaussSCRAMSha256PasswordAuthenticator;
 
diff --git 
a/proxy/frontend/type/opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/authenticator/impl/OpenGaussMD5PasswordAuthenticator.java
 
b/proxy/frontend/type/opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/authenticator/impl/OpenGaussMD5PasswordAuthenticator.java
index 728ac688d97..59374f87ba0 100644
--- 
a/proxy/frontend/type/opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/authenticator/impl/OpenGaussMD5PasswordAuthenticator.java
+++ 
b/proxy/frontend/type/opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/authenticator/impl/OpenGaussMD5PasswordAuthenticator.java
@@ -17,7 +17,6 @@
 
 package 
org.apache.shardingsphere.proxy.frontend.opengauss.authentication.authenticator.impl;
 
-import org.apache.shardingsphere.db.protocol.constant.AuthenticationMethod;
 import 
org.apache.shardingsphere.db.protocol.postgresql.constant.PostgreSQLAuthenticationMethod;
 import org.apache.shardingsphere.infra.metadata.user.ShardingSphereUser;
 import 
org.apache.shardingsphere.proxy.frontend.opengauss.authentication.authenticator.OpenGaussAuthenticator;
@@ -34,7 +33,7 @@ public final class OpenGaussMD5PasswordAuthenticator 
implements OpenGaussAuthent
     }
     
     @Override
-    public AuthenticationMethod getAuthenticationMethod() {
-        return PostgreSQLAuthenticationMethod.MD5;
+    public String getAuthenticationMethodName() {
+        return PostgreSQLAuthenticationMethod.MD5.getMethodName();
     }
 }
diff --git 
a/proxy/frontend/type/opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/authenticator/impl/OpenGaussSCRAMSha256PasswordAuthenticator.java
 
b/proxy/frontend/type/opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/authenticator/impl/OpenGaussSCRAMSha256PasswordAuthenticator.java
index 30306ce5ea5..f4022d3ff6a 100644
--- 
a/proxy/frontend/type/opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/authenticator/impl/OpenGaussSCRAMSha256PasswordAuthenticator.java
+++ 
b/proxy/frontend/type/opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/authenticator/impl/OpenGaussSCRAMSha256PasswordAuthenticator.java
@@ -17,7 +17,6 @@
 
 package 
org.apache.shardingsphere.proxy.frontend.opengauss.authentication.authenticator.impl;
 
-import org.apache.shardingsphere.db.protocol.constant.AuthenticationMethod;
 import 
org.apache.shardingsphere.db.protocol.opengauss.constant.OpenGaussAuthenticationMethod;
 import 
org.apache.shardingsphere.db.protocol.opengauss.packet.authentication.OpenGaussMacCalculator;
 import org.apache.shardingsphere.infra.metadata.user.ShardingSphereUser;
@@ -42,7 +41,7 @@ public final class OpenGaussSCRAMSha256PasswordAuthenticator 
implements OpenGaus
     }
     
     @Override
-    public AuthenticationMethod getAuthenticationMethod() {
-        return OpenGaussAuthenticationMethod.SCRAM_SHA256;
+    public String getAuthenticationMethodName() {
+        return OpenGaussAuthenticationMethod.SCRAM_SHA256.getMethodName();
     }
 }
diff --git 
a/proxy/frontend/type/opengauss/src/test/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/OpenGaussAuthenticationEngineTest.java
 
b/proxy/frontend/type/opengauss/src/test/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/OpenGaussAuthenticationEngineTest.java
index 38586f42028..4afca9ccf2a 100644
--- 
a/proxy/frontend/type/opengauss/src/test/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/OpenGaussAuthenticationEngineTest.java
+++ 
b/proxy/frontend/type/opengauss/src/test/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/OpenGaussAuthenticationEngineTest.java
@@ -43,7 +43,7 @@ import 
org.apache.shardingsphere.metadata.persist.MetaDataPersistService;
 import org.apache.shardingsphere.mode.manager.ContextManager;
 import org.apache.shardingsphere.mode.metadata.MetaDataContexts;
 import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import 
org.apache.shardingsphere.proxy.frontend.authentication.AuthenticationResult;
+import org.apache.shardingsphere.authentication.result.AuthenticationResult;
 import org.apache.shardingsphere.proxy.frontend.ssl.ProxySSLContext;
 import org.apache.shardingsphere.test.mock.AutoMockExtension;
 import org.apache.shardingsphere.test.mock.StaticMockSettings;
diff --git 
a/proxy/frontend/type/opengauss/src/test/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/authenticator/OpenGaussAuthenticatorTypeTest.java
 
b/proxy/frontend/type/opengauss/src/test/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/authenticator/OpenGaussAuthenticatorTypeTest.java
index ab0c4f05d3d..ec2a97b2392 100644
--- 
a/proxy/frontend/type/opengauss/src/test/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/authenticator/OpenGaussAuthenticatorTypeTest.java
+++ 
b/proxy/frontend/type/opengauss/src/test/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/authenticator/OpenGaussAuthenticatorTypeTest.java
@@ -19,8 +19,8 @@ package 
org.apache.shardingsphere.proxy.frontend.opengauss.authentication.authen
 
 import org.apache.shardingsphere.authority.rule.AuthorityRule;
 import org.apache.shardingsphere.infra.metadata.user.ShardingSphereUser;
-import org.apache.shardingsphere.proxy.frontend.authentication.Authenticator;
-import 
org.apache.shardingsphere.proxy.frontend.authentication.AuthenticatorFactory;
+import org.apache.shardingsphere.authentication.Authenticator;
+import org.apache.shardingsphere.authentication.AuthenticatorFactory;
 import org.junit.jupiter.api.extension.ExtensionContext;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.Arguments;
@@ -44,7 +44,7 @@ class OpenGaussAuthenticatorTypeTest {
     void assertAuthenticator(final String name, final String 
authenticatorType, final String expectedAuthenticatorMethodName) {
         when(rule.getAuthenticatorType(any())).thenReturn(authenticatorType);
         Authenticator actual = new 
AuthenticatorFactory<>(OpenGaussAuthenticatorType.class, 
rule).newInstance(mock(ShardingSphereUser.class));
-        assertThat(actual.getAuthenticationMethod().getMethodName(), 
is(expectedAuthenticatorMethodName));
+        assertThat(actual.getAuthenticationMethodName(), 
is(expectedAuthenticatorMethodName));
     }
     
     private static class TestCaseArgumentsProvider implements 
ArgumentsProvider {
diff --git 
a/proxy/frontend/type/opengauss/src/test/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/authenticator/impl/OpenGaussMD5PasswordAuthenticatorTest.java
 
b/proxy/frontend/type/opengauss/src/test/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/authenticator/impl/OpenGaussMD5PasswordAuthenticatorTest.java
index 07ebbb3916c..c8f86b766b7 100644
--- 
a/proxy/frontend/type/opengauss/src/test/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/authenticator/impl/OpenGaussMD5PasswordAuthenticatorTest.java
+++ 
b/proxy/frontend/type/opengauss/src/test/java/org/apache/shardingsphere/proxy/frontend/opengauss/authentication/authenticator/impl/OpenGaussMD5PasswordAuthenticatorTest.java
@@ -37,7 +37,7 @@ class OpenGaussMD5PasswordAuthenticatorTest {
     
     @Test
     void assertAuthenticationMethodName() {
-        assertThat(new 
OpenGaussMD5PasswordAuthenticator().getAuthenticationMethod().getMethodName(), 
is("md5"));
+        assertThat(new 
OpenGaussMD5PasswordAuthenticator().getAuthenticationMethodName(), is("md5"));
     }
     
     @Test
diff --git 
a/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationEngine.java
 
b/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationEngine.java
index 76bc6fb8281..f94a62f1375 100644
--- 
a/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationEngine.java
+++ 
b/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationEngine.java
@@ -53,10 +53,10 @@ import 
org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
 import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
 import 
org.apache.shardingsphere.proxy.backend.postgresql.handler.admin.executor.variable.charset.PostgreSQLCharacterSets;
 import 
org.apache.shardingsphere.proxy.frontend.authentication.AuthenticationEngine;
-import 
org.apache.shardingsphere.proxy.frontend.authentication.AuthenticationResult;
-import 
org.apache.shardingsphere.proxy.frontend.authentication.AuthenticationResultBuilder;
-import org.apache.shardingsphere.proxy.frontend.authentication.Authenticator;
-import 
org.apache.shardingsphere.proxy.frontend.authentication.AuthenticatorFactory;
+import org.apache.shardingsphere.authentication.result.AuthenticationResult;
+import 
org.apache.shardingsphere.authentication.result.AuthenticationResultBuilder;
+import org.apache.shardingsphere.authentication.Authenticator;
+import org.apache.shardingsphere.authentication.AuthenticatorFactory;
 import 
org.apache.shardingsphere.proxy.frontend.connection.ConnectionIdGenerator;
 import 
org.apache.shardingsphere.proxy.frontend.postgresql.authentication.authenticator.PostgreSQLAuthenticatorType;
 import org.apache.shardingsphere.proxy.frontend.ssl.ProxySSLContext;
@@ -144,7 +144,7 @@ public final class PostgreSQLAuthenticationEngine 
implements AuthenticationEngin
     
     private PostgreSQLIdentifierPacket getIdentifierPacket(final String 
username, final AuthorityRule rule) {
         Optional<Authenticator> authenticator = rule.findUser(new 
Grantee(username, "")).map(optional -> new 
AuthenticatorFactory<>(PostgreSQLAuthenticatorType.class, 
rule).newInstance(optional));
-        if (authenticator.isPresent() && 
PostgreSQLAuthenticationMethod.PASSWORD == 
authenticator.get().getAuthenticationMethod()) {
+        if (authenticator.isPresent() && 
PostgreSQLAuthenticationMethod.PASSWORD.getMethodName().equals(authenticator.get().getAuthenticationMethodName()))
 {
             return new PostgreSQLPasswordAuthenticationPacket();
         }
         md5Salt = 
PostgreSQLRandomGenerator.getInstance().generateRandomBytes(4);
diff --git 
a/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/authenticator/PostgreSQLAuthenticator.java
 
b/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/authenticator/PostgreSQLAuthenticator.java
index 8987164402b..59f0eab360b 100644
--- 
a/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/authenticator/PostgreSQLAuthenticator.java
+++ 
b/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/authenticator/PostgreSQLAuthenticator.java
@@ -17,7 +17,7 @@
 
 package 
org.apache.shardingsphere.proxy.frontend.postgresql.authentication.authenticator;
 
-import org.apache.shardingsphere.proxy.frontend.authentication.Authenticator;
+import org.apache.shardingsphere.authentication.Authenticator;
 
 /**
  * PostgreSQL authenticator.
diff --git 
a/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/authenticator/PostgreSQLAuthenticatorType.java
 
b/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/authenticator/PostgreSQLAuthenticatorType.java
index 55313ad5cef..dd6dd3a233e 100644
--- 
a/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/authenticator/PostgreSQLAuthenticatorType.java
+++ 
b/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/authenticator/PostgreSQLAuthenticatorType.java
@@ -19,7 +19,7 @@ package 
org.apache.shardingsphere.proxy.frontend.postgresql.authentication.authe
 
 import lombok.Getter;
 import lombok.RequiredArgsConstructor;
-import 
org.apache.shardingsphere.proxy.frontend.authentication.AuthenticatorType;
+import org.apache.shardingsphere.authentication.AuthenticatorType;
 import 
org.apache.shardingsphere.proxy.frontend.postgresql.authentication.authenticator.impl.PostgreSQLMD5PasswordAuthenticator;
 import 
org.apache.shardingsphere.proxy.frontend.postgresql.authentication.authenticator.impl.PostgreSQLPasswordAuthenticator;
 
diff --git 
a/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/authenticator/impl/PostgreSQLMD5PasswordAuthenticator.java
 
b/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/authenticator/impl/PostgreSQLMD5PasswordAuthenticator.java
index 340249e3f1e..353441aaa02 100644
--- 
a/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/authenticator/impl/PostgreSQLMD5PasswordAuthenticator.java
+++ 
b/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/authenticator/impl/PostgreSQLMD5PasswordAuthenticator.java
@@ -19,7 +19,6 @@ package 
org.apache.shardingsphere.proxy.frontend.postgresql.authentication.authe
 
 import org.apache.commons.codec.binary.Hex;
 import org.apache.commons.codec.digest.DigestUtils;
-import org.apache.shardingsphere.db.protocol.constant.AuthenticationMethod;
 import 
org.apache.shardingsphere.db.protocol.postgresql.constant.PostgreSQLAuthenticationMethod;
 import org.apache.shardingsphere.infra.metadata.user.ShardingSphereUser;
 import 
org.apache.shardingsphere.proxy.frontend.postgresql.authentication.authenticator.PostgreSQLAuthenticator;
@@ -48,7 +47,7 @@ public final class PostgreSQLMD5PasswordAuthenticator 
implements PostgreSQLAuthe
     }
     
     @Override
-    public AuthenticationMethod getAuthenticationMethod() {
-        return PostgreSQLAuthenticationMethod.MD5;
+    public String getAuthenticationMethodName() {
+        return PostgreSQLAuthenticationMethod.MD5.getMethodName();
     }
 }
diff --git 
a/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/authenticator/impl/PostgreSQLPasswordAuthenticator.java
 
b/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/authenticator/impl/PostgreSQLPasswordAuthenticator.java
index 95ec85ef32e..43834320222 100644
--- 
a/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/authenticator/impl/PostgreSQLPasswordAuthenticator.java
+++ 
b/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/authenticator/impl/PostgreSQLPasswordAuthenticator.java
@@ -18,7 +18,6 @@
 package 
org.apache.shardingsphere.proxy.frontend.postgresql.authentication.authenticator.impl;
 
 import com.google.common.base.Strings;
-import org.apache.shardingsphere.db.protocol.constant.AuthenticationMethod;
 import 
org.apache.shardingsphere.db.protocol.postgresql.constant.PostgreSQLAuthenticationMethod;
 import org.apache.shardingsphere.infra.metadata.user.ShardingSphereUser;
 import 
org.apache.shardingsphere.proxy.frontend.postgresql.authentication.authenticator.PostgreSQLAuthenticator;
@@ -35,7 +34,7 @@ public final class PostgreSQLPasswordAuthenticator implements 
PostgreSQLAuthenti
     }
     
     @Override
-    public AuthenticationMethod getAuthenticationMethod() {
-        return PostgreSQLAuthenticationMethod.PASSWORD;
+    public String getAuthenticationMethodName() {
+        return PostgreSQLAuthenticationMethod.PASSWORD.getMethodName();
     }
 }
diff --git 
a/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationEngineTest.java
 
b/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationEngineTest.java
index e4d818a12a5..4265fe1cc42 100644
--- 
a/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationEngineTest.java
+++ 
b/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationEngineTest.java
@@ -46,7 +46,7 @@ import org.apache.shardingsphere.mode.manager.ContextManager;
 import org.apache.shardingsphere.mode.metadata.MetaDataContexts;
 import org.apache.shardingsphere.metadata.persist.MetaDataPersistService;
 import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import 
org.apache.shardingsphere.proxy.frontend.authentication.AuthenticationResult;
+import org.apache.shardingsphere.authentication.result.AuthenticationResult;
 import 
org.apache.shardingsphere.proxy.frontend.postgresql.authentication.authenticator.impl.PostgreSQLMD5PasswordAuthenticator;
 import org.apache.shardingsphere.proxy.frontend.ssl.ProxySSLContext;
 import org.apache.shardingsphere.test.mock.AutoMockExtension;
diff --git 
a/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/authenticator/PostgreSQLAuthenticatorTypeTest.java
 
b/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/authenticator/PostgreSQLAuthenticatorTypeTest.java
index ee5f974ae40..ec9b763ebfc 100644
--- 
a/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/authenticator/PostgreSQLAuthenticatorTypeTest.java
+++ 
b/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/authenticator/PostgreSQLAuthenticatorTypeTest.java
@@ -19,8 +19,8 @@ package 
org.apache.shardingsphere.proxy.frontend.postgresql.authentication.authe
 
 import org.apache.shardingsphere.authority.rule.AuthorityRule;
 import org.apache.shardingsphere.infra.metadata.user.ShardingSphereUser;
-import org.apache.shardingsphere.proxy.frontend.authentication.Authenticator;
-import 
org.apache.shardingsphere.proxy.frontend.authentication.AuthenticatorFactory;
+import org.apache.shardingsphere.authentication.Authenticator;
+import org.apache.shardingsphere.authentication.AuthenticatorFactory;
 import org.junit.jupiter.api.extension.ExtensionContext;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.Arguments;
@@ -44,7 +44,7 @@ class PostgreSQLAuthenticatorTypeTest {
     void assertAuthenticator(final String name, final String 
authenticatorType, final String expectedAuthenticatorMethodName) {
         when(rule.getAuthenticatorType(any())).thenReturn(authenticatorType);
         Authenticator actual = new 
AuthenticatorFactory<>(PostgreSQLAuthenticatorType.class, 
rule).newInstance(mock(ShardingSphereUser.class));
-        assertThat(actual.getAuthenticationMethod().getMethodName(), 
is(expectedAuthenticatorMethodName));
+        assertThat(actual.getAuthenticationMethodName(), 
is(expectedAuthenticatorMethodName));
     }
     
     private static class TestCaseArgumentsProvider implements 
ArgumentsProvider {
diff --git 
a/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/authenticator/impl/PostgreSQLMD5PasswordAuthenticatorTest.java
 
b/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/authenticator/impl/PostgreSQLMD5PasswordAuthenticatorTest.java
index 1ace09311ba..d1da9b8cba9 100644
--- 
a/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/authenticator/impl/PostgreSQLMD5PasswordAuthenticatorTest.java
+++ 
b/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/authenticator/impl/PostgreSQLMD5PasswordAuthenticatorTest.java
@@ -36,7 +36,7 @@ class PostgreSQLMD5PasswordAuthenticatorTest {
     
     @Test
     void assertAuthenticationMethodName() {
-        assertThat(new 
PostgreSQLMD5PasswordAuthenticator().getAuthenticationMethod().getMethodName(), 
is("md5"));
+        assertThat(new 
PostgreSQLMD5PasswordAuthenticator().getAuthenticationMethodName(), is("md5"));
     }
     
     @Test
diff --git 
a/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/authenticator/impl/PostgreSQLPasswordAuthenticatorTest.java
 
b/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/authenticator/impl/PostgreSQLPasswordAuthenticatorTest.java
index 3243da57a68..20fc172ce96 100644
--- 
a/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/authenticator/impl/PostgreSQLPasswordAuthenticatorTest.java
+++ 
b/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/authenticator/impl/PostgreSQLPasswordAuthenticatorTest.java
@@ -29,7 +29,7 @@ class PostgreSQLPasswordAuthenticatorTest {
     
     @Test
     void assertAuthenticationMethodName() {
-        assertThat(new 
PostgreSQLPasswordAuthenticator().getAuthenticationMethod().getMethodName(), 
is("password"));
+        assertThat(new 
PostgreSQLPasswordAuthenticator().getAuthenticationMethodName(), 
is("password"));
     }
     
     @Test

Reply via email to