diff --git a/fe/fe-common/src/main/java/org/apache/doris/common/security/authentication/HadoopSimpleAuthenticator.java b/fe/fe-common/src/main/java/org/apache/doris/common/security/authentication/HadoopSimpleAuthenticator.java index 44cf01b567fb137..01cb9ac2b8ec9b6 100644 --- a/fe/fe-common/src/main/java/org/apache/doris/common/security/authentication/HadoopSimpleAuthenticator.java +++ b/fe/fe-common/src/main/java/org/apache/doris/common/security/authentication/HadoopSimpleAuthenticator.java @@ -21,38 +21,25 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import java.io.IOException; import java.security.PrivilegedExceptionAction; public class HadoopSimpleAuthenticator implements HadoopAuthenticator { private static final Logger LOG = LogManager.getLogger(HadoopSimpleAuthenticator.class); - private final SimpleAuthenticationConfig config; - private UserGroupInformation ugi; + private final UserGroupInformation ugi; public HadoopSimpleAuthenticator(SimpleAuthenticationConfig config) { - this.config = config; - } - - @Override - public UserGroupInformation getUGI() { String hadoopUserName = config.getUsername(); if (hadoopUserName == null) { hadoopUserName = "hadoop"; config.setUsername(hadoopUserName); - LOG.debug(AuthenticationConfig.HADOOP_USER_NAME + " is unset, use default user: hadoop"); - } - try { - // get login user just for simple auth - ugi = UserGroupInformation.getLoginUser(); - if (ugi.getUserName().equals(hadoopUserName)) { - return ugi; - } - } catch (IOException e) { - LOG.warn("A SecurityException occurs with simple, do login immediately.", e); + LOG.debug("{} is unset, use default user: hadoop", AuthenticationConfig.HADOOP_USER_NAME); } ugi = UserGroupInformation.createRemoteUser(hadoopUserName); - UserGroupInformation.setLoginUser(ugi); LOG.debug("Login by proxy user, hadoop.username: {}", hadoopUserName); + } + + @Override + public UserGroupInformation getUGI() { return ugi; }