From 010cfdfcd54fec6711e480d4fef17f7678546b00 Mon Sep 17 00:00:00 2001 From: Bowen Liang Date: Thu, 27 Oct 2022 11:11:01 +0800 Subject: [PATCH] [KYUUBI #3701] Allow JDBC authencation to connect auth db with no user name ### _Why are the changes needed?_ to close #3701 . ### _How was this patch tested?_ - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible - [ ] Add screenshots for manual tests if appropriate - [x] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request Closes #3702 from bowenliang123/3701-jdbc-auth. Closes #3701 7a04d091 [Bowen Liang] skip not empty checking for kyuubi.authentication.jdbc.user config Authored-by: Bowen Liang Signed-off-by: Cheng Pan --- .../authentication/JdbcAuthenticationProviderImpl.scala | 3 +-- .../authentication/JdbcAuthenticationProviderImplSuite.scala | 5 ----- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/kyuubi-common/src/main/scala/org/apache/kyuubi/service/authentication/JdbcAuthenticationProviderImpl.scala b/kyuubi-common/src/main/scala/org/apache/kyuubi/service/authentication/JdbcAuthenticationProviderImpl.scala index e2b1ba476..898e5a9bc 100644 --- a/kyuubi-common/src/main/scala/org/apache/kyuubi/service/authentication/JdbcAuthenticationProviderImpl.scala +++ b/kyuubi-common/src/main/scala/org/apache/kyuubi/service/authentication/JdbcAuthenticationProviderImpl.scala @@ -108,8 +108,7 @@ class JdbcAuthenticationProviderImpl(conf: KyuubiConf) extends PasswdAuthenticat // Check if JDBC parameters valid require(driverClass.nonEmpty, "JDBC driver class is not configured.") require(authDbJdbcUrl.nonEmpty, "JDBC url is not configured.") - require(authDbUser.nonEmpty, "JDBC user is not configured.") - // allow empty auth db password + // allow empty auth db user or password require(authQuery.nonEmpty, "Query SQL is not configured") val query = authQuery.get.trim.toLowerCase diff --git a/kyuubi-common/src/test/scala/org/apache/kyuubi/service/authentication/JdbcAuthenticationProviderImplSuite.scala b/kyuubi-common/src/test/scala/org/apache/kyuubi/service/authentication/JdbcAuthenticationProviderImplSuite.scala index 7c45ed50e..dcbc62dfa 100644 --- a/kyuubi-common/src/test/scala/org/apache/kyuubi/service/authentication/JdbcAuthenticationProviderImplSuite.scala +++ b/kyuubi-common/src/test/scala/org/apache/kyuubi/service/authentication/JdbcAuthenticationProviderImplSuite.scala @@ -104,11 +104,6 @@ class JdbcAuthenticationProviderImplSuite extends KyuubiFunSuite { val e5 = intercept[IllegalArgumentException] { new JdbcAuthenticationProviderImpl(_conf) } assert(e5.getMessage.contains("JDBC url is not configured")) - _conf = conf.clone - _conf.unset(AUTHENTICATION_JDBC_USER) - val e6 = intercept[IllegalArgumentException] { new JdbcAuthenticationProviderImpl(_conf) } - assert(e6.getMessage.contains("JDBC user is not configured")) - _conf = conf.clone _conf.unset(AUTHENTICATION_JDBC_QUERY) val e8 = intercept[IllegalArgumentException] { new JdbcAuthenticationProviderImpl(_conf) }