fix ldap none.get

This commit is contained in:
Kent Yao 2020-10-26 00:18:34 +08:00
parent 9da3400651
commit af9babe0b6
2 changed files with 5 additions and 1 deletions

View File

@ -58,7 +58,7 @@ class LdapAuthenticationProviderImpl(conf: KyuubiConf) extends PasswdAuthenticat
val domain = conf.get(AUTHENTICATION_LDAP_DOMAIN) val domain = conf.get(AUTHENTICATION_LDAP_DOMAIN)
val u = if (!hasDomain(user) && domain.nonEmpty) { val u = if (!hasDomain(user) && domain.nonEmpty) {
user + "@" + domain user + "@" + domain.get
} else { } else {
user user
} }

View File

@ -181,5 +181,9 @@ class LdapAuthenticationProviderImplSuite extends KyuubiFunSuite {
assert(e5.getMessage.contains(user)) assert(e5.getMessage.contains(user))
assert(e5.getCause.isInstanceOf[CommunicationException]) assert(e5.getCause.isInstanceOf[CommunicationException])
conf.set(AUTHENTICATION_LDAP_DOMAIN, "kyuubi.com")
val providerImpl4 = new LdapAuthenticationProviderImpl(conf)
intercept[AuthenticationException](providerImpl4.authenticate("kentyao", "kentyao"))
} }
} }