From af9babe0b635960da52d651db2e074de2930ff93 Mon Sep 17 00:00:00 2001 From: Kent Yao Date: Mon, 26 Oct 2020 00:18:34 +0800 Subject: [PATCH] fix ldap none.get --- .../authentication/LdapAuthenticationProviderImpl.scala | 2 +- .../authentication/LdapAuthenticationProviderImplSuite.scala | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) 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")) } }