From dc71e38e950111ca55cc103fd22ef402304f44bb Mon Sep 17 00:00:00 2001 From: lifulong Date: Thu, 26 Sep 2024 10:09:20 -0700 Subject: [PATCH] [KYUUBI #6709] Fix seq and set equals check bug while check auth type in AuthenticationFilter.initAuthHandlers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # :mag: Description ## Issue References ๐Ÿ”— This pull request fixes #6709 ## Describe Your Solution ๐Ÿ”ง transfer the type of authTypes from seq to set before do equals check ## Types of changes :bookmark: - [x] Bugfix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) ## Test Plan ๐Ÿงช test in our produce kyuubi env #### Behavior Without This Pull Request :coffin: image image always hint to login in all sub tabs of management tab in kyuubi web ui, but can not login in actually, while use confkyuubi.authentication NOSASL, and our java version is 1.8 scala version is 2.12.18 #### Behavior With This Pull Request :tada: image #### Related Unit Tests none, no need i think --- # Checklist ๐Ÿ“ - [ ] This patch was not authored or co-authored using [Generative Tooling](https://www.apache.org/legal/generative-tooling.html) **Be nice. Be informative.** Closes #6711 from lifulong/authentication_filter_auth_type_bug_fix. Closes #6709 850bda4f3 [lifulong] fix seq and set equals check bug while check auth type in AuthenticationFilter.initAuthHandlers Authored-by: lifulong Signed-off-by: Wang, Fei (cherry picked from commit 14bf56f64f9b16066465553397a1621af59da8d9) Signed-off-by: Wang, Fei --- .../server/http/authentication/AuthenticationFilter.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kyuubi-server/src/main/scala/org/apache/kyuubi/server/http/authentication/AuthenticationFilter.scala b/kyuubi-server/src/main/scala/org/apache/kyuubi/server/http/authentication/AuthenticationFilter.scala index 15b387607..706b411df 100644 --- a/kyuubi-server/src/main/scala/org/apache/kyuubi/server/http/authentication/AuthenticationFilter.scala +++ b/kyuubi-server/src/main/scala/org/apache/kyuubi/server/http/authentication/AuthenticationFilter.scala @@ -58,7 +58,7 @@ class AuthenticationFilter(conf: KyuubiConf) extends Filter with Logging { val authTypes = conf.get(AUTHENTICATION_METHOD).map(AuthTypes.withName) val spnegoKerberosEnabled = authTypes.contains(KERBEROS) val basicAuthTypeOpt = { - if (authTypes == Set(NOSASL)) { + if (authTypes.toSet == Set(NOSASL)) { authTypes.headOption } else { authTypes.filterNot(_.equals(KERBEROS)).filterNot(_.equals(NOSASL)).headOption