This commit is contained in:
Kent Yao 2018-12-11 18:10:13 +08:00
parent 48a15c620e
commit 672fba544a
2 changed files with 11 additions and 1 deletions

View File

@ -31,6 +31,10 @@ class AuthenticationProviderFactorySuite extends SparkFunSuite {
val ldap = AuthenticationProviderFactory.getAuthenticationProvider(AuthMethods.LDAP, conf)
val exception = intercept[AuthenticationException](ldap.authenticate("test", "test"))
assert(exception.getMessage.contains("Error validating LDAP user:"))
val e2 = intercept[AuthenticationException](
AuthenticationProviderFactory.getAuthenticationProvider(null, conf))
assert(e2.getMessage === "Not a valid authentication method")
}
}

View File

@ -25,7 +25,6 @@ import org.apache.hadoop.security.authorize.AuthorizationException
import org.apache.spark.{KyuubiConf, KyuubiSparkUtil, SparkConf, SparkFunSuite}
import yaooqinn.kyuubi.KyuubiSQLException
import yaooqinn.kyuubi.server.KyuubiServer
import yaooqinn.kyuubi.service.ServiceException
import yaooqinn.kyuubi.utils.ReflectUtils
@ -81,6 +80,13 @@ class KyuubiAuthFactorySuite extends SparkFunSuite {
assert(e.getMessage === "Unsupported authentication method: OTHER")
}
test("AuthType LDAP") {
val conf = new SparkConf(true).set(KyuubiConf.AUTHENTICATION_METHOD.key, "LDAP")
KyuubiSparkUtil.setupCommonConfig(conf)
val authFactory = new KyuubiAuthFactory(conf)
assert(authFactory.getIpAddress.isEmpty)
}
test("AuthType KERBEROS without keytab/principal") {
val conf = new SparkConf(true).set(KyuubiConf.AUTHENTICATION_METHOD.key, "KERBEROS")
KyuubiSparkUtil.setupCommonConfig(conf)