diff --git a/kyuubi-common/src/test/scala/org/apache/kyuubi/service/authentication/AuthenticationProviderFactorySuite.scala b/kyuubi-common/src/test/scala/org/apache/kyuubi/service/authentication/AuthenticationProviderFactorySuite.scala index 0bd29ac56a9..b8de4eaa880 100644 --- a/kyuubi-common/src/test/scala/org/apache/kyuubi/service/authentication/AuthenticationProviderFactorySuite.scala +++ b/kyuubi-common/src/test/scala/org/apache/kyuubi/service/authentication/AuthenticationProviderFactorySuite.scala @@ -21,6 +21,7 @@ import javax.security.sasl.AuthenticationException import org.apache.kyuubi.{KyuubiFunSuite, Utils} import org.apache.kyuubi.config.KyuubiConf +import org.apache.kyuubi.config.KyuubiConf.FrontendProtocols.THRIFT_BINARY class AuthenticationProviderFactorySuite extends KyuubiFunSuite { @@ -28,13 +29,13 @@ class AuthenticationProviderFactorySuite extends KyuubiFunSuite { test("get auth provider") { val conf = KyuubiConf() - val p1 = getAuthenticationProvider(AuthMethods.withName("NONE"), conf) + val p1 = getAuthenticationProvider(AuthMethods.withName("NONE"), conf, THRIFT_BINARY) p1.authenticate(Utils.currentUser, "") - val p2 = getAuthenticationProvider(AuthMethods.withName("LDAP"), conf) + val p2 = getAuthenticationProvider(AuthMethods.withName("LDAP"), conf, THRIFT_BINARY) val e1 = intercept[AuthenticationException](p2.authenticate("test", "test")) assert(e1.getMessage.contains("Error validating LDAP user:")) val e2 = intercept[AuthenticationException]( - AuthenticationProviderFactory.getAuthenticationProvider(null, conf)) + AuthenticationProviderFactory.getAuthenticationProvider(null, conf, THRIFT_BINARY)) assert(e2.getMessage === "Not a valid authentication method") } diff --git a/kyuubi-common/src/test/scala/org/apache/kyuubi/service/authentication/CustomAuthenticationProviderImplSuite.scala b/kyuubi-common/src/test/scala/org/apache/kyuubi/service/authentication/CustomAuthenticationProviderImplSuite.scala index 6135535e1d7..fd3d8fbf405 100644 --- a/kyuubi-common/src/test/scala/org/apache/kyuubi/service/authentication/CustomAuthenticationProviderImplSuite.scala +++ b/kyuubi-common/src/test/scala/org/apache/kyuubi/service/authentication/CustomAuthenticationProviderImplSuite.scala @@ -21,6 +21,7 @@ import javax.security.sasl.AuthenticationException import org.apache.kyuubi.KyuubiFunSuite import org.apache.kyuubi.config.KyuubiConf +import org.apache.kyuubi.config.KyuubiConf.FrontendProtocols.THRIFT_BINARY import org.apache.kyuubi.service.authentication.AuthenticationProviderFactory.getAuthenticationProvider class CustomAuthenticationProviderImplSuite extends KyuubiFunSuite { @@ -28,14 +29,14 @@ class CustomAuthenticationProviderImplSuite extends KyuubiFunSuite { val conf = KyuubiConf() val e1 = intercept[AuthenticationException]( - getAuthenticationProvider(AuthMethods.withName("CUSTOM"), conf)) + getAuthenticationProvider(AuthMethods.withName("CUSTOM"), conf, THRIFT_BINARY)) assert(e1.getMessage.contains( "authentication.custom.class must be set when auth method was CUSTOM.")) conf.set( KyuubiConf.AUTHENTICATION_CUSTOM_CLASS, classOf[UserDefineAuthenticationProviderImpl].getCanonicalName) - val p1 = getAuthenticationProvider(AuthMethods.withName("CUSTOM"), conf) + val p1 = getAuthenticationProvider(AuthMethods.withName("CUSTOM"), conf, THRIFT_BINARY) val e2 = intercept[AuthenticationException](p1.authenticate("test", "test")) assert(e2.getMessage.contains("Username or password is not valid!")) diff --git a/kyuubi-server/src/test/scala/org/apache/kyuubi/server/http/authentication/AuthenticationFilterSuite.scala b/kyuubi-server/src/test/scala/org/apache/kyuubi/server/http/authentication/AuthenticationFilterSuite.scala index 62f4fa16aab..bfbae42606d 100644 --- a/kyuubi-server/src/test/scala/org/apache/kyuubi/server/http/authentication/AuthenticationFilterSuite.scala +++ b/kyuubi-server/src/test/scala/org/apache/kyuubi/server/http/authentication/AuthenticationFilterSuite.scala @@ -20,18 +20,22 @@ package org.apache.kyuubi.server.http.authentication import org.apache.kyuubi.KyuubiFunSuite import org.apache.kyuubi.config.KyuubiConf import org.apache.kyuubi.config.KyuubiConf.AUTHENTICATION_METHOD +import org.apache.kyuubi.config.KyuubiConf.FrontendProtocols.{THRIFT_BINARY, THRIFT_HTTP} import org.apache.kyuubi.service.authentication.AuthTypes class AuthenticationFilterSuite extends KyuubiFunSuite { test("add auth handler and destroy") { val conf = KyuubiConf() val filter = - new AuthenticationFilter(conf, conf.get(AUTHENTICATION_METHOD).map(AuthTypes.withName)) - filter.addAuthHandler(new BasicAuthenticationHandler(null)) + new AuthenticationFilter( + conf, + conf.get(AUTHENTICATION_METHOD).map(AuthTypes.withName), + THRIFT_BINARY) + filter.addAuthHandler(new BasicAuthenticationHandler(null, THRIFT_BINARY)) assert(filter.authSchemeHandlers.isEmpty) - filter.addAuthHandler(new BasicAuthenticationHandler(AuthTypes.LDAP)) + filter.addAuthHandler(new BasicAuthenticationHandler(AuthTypes.LDAP, THRIFT_BINARY)) assert(filter.authSchemeHandlers.size == 1) - filter.addAuthHandler(new BasicAuthenticationHandler(AuthTypes.LDAP)) + filter.addAuthHandler(new BasicAuthenticationHandler(AuthTypes.LDAP, THRIFT_BINARY)) assert(filter.authSchemeHandlers.size == 1) filter.addAuthHandler(new KerberosAuthenticationHandler()) assert(filter.authSchemeHandlers.size == 1)