diff --git a/kyuubi-common/src/main/scala/org/apache/kyuubi/service/authentication/LdapAuthenticationProviderImpl.scala b/kyuubi-common/src/main/scala/org/apache/kyuubi/service/authentication/LdapAuthenticationProviderImpl.scala index 6962ab3e0..a7b5b9401 100644 --- a/kyuubi-common/src/main/scala/org/apache/kyuubi/service/authentication/LdapAuthenticationProviderImpl.scala +++ b/kyuubi-common/src/main/scala/org/apache/kyuubi/service/authentication/LdapAuthenticationProviderImpl.scala @@ -58,7 +58,7 @@ class LdapAuthenticationProviderImpl(conf: KyuubiConf) extends PasswdAuthenticat val domain = conf.get(AUTHENTICATION_LDAP_DOMAIN) val u = if (!hasDomain(user) && domain.nonEmpty) { - user + "@" + domain + user + "@" + domain.get } else { user } diff --git a/kyuubi-common/src/test/scala/org/apache/kyuubi/service/authentication/LdapAuthenticationProviderImplSuite.scala b/kyuubi-common/src/test/scala/org/apache/kyuubi/service/authentication/LdapAuthenticationProviderImplSuite.scala index 21ac6d5c4..8aea7b24a 100644 --- a/kyuubi-common/src/test/scala/org/apache/kyuubi/service/authentication/LdapAuthenticationProviderImplSuite.scala +++ b/kyuubi-common/src/test/scala/org/apache/kyuubi/service/authentication/LdapAuthenticationProviderImplSuite.scala @@ -181,5 +181,9 @@ class LdapAuthenticationProviderImplSuite extends KyuubiFunSuite { assert(e5.getMessage.contains(user)) assert(e5.getCause.isInstanceOf[CommunicationException]) + + conf.set(AUTHENTICATION_LDAP_DOMAIN, "kyuubi.com") + val providerImpl4 = new LdapAuthenticationProviderImpl(conf) + intercept[AuthenticationException](providerImpl4.authenticate("kentyao", "kentyao")) } }