Skip to content

Commit

Permalink
[KYUUBI #5568][FOLLOWUP] Fix security enabled judgement
Browse files Browse the repository at this point in the history
### _Why are the changes needed?_

There are two enumeration classes, AuthTypes and AuthMethods, the previous PR messed it up ...

### _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.readthedocs.io/en/master/contributing/code/testing.html#running-tests) locally before make a pull request

I also tested it local by building a binary dist and running with auth NONE

### _Was this patch authored or co-authored using generative AI tooling?_

No

Closes #5604 from pan3793/auth-check.

Closes #5568

e41c2ab [Cheng Pan] [KYUUBI #5568][FOLLOWUP] Fix security enabled judgement

Authored-by: Cheng Pan <[email protected]>
Signed-off-by: Cheng Pan <[email protected]>
  • Loading branch information
pan3793 committed Nov 2, 2023
1 parent ea9a78f commit eaad093
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ object KyuubiAuthenticationFactory extends Logging {
}

def getValidPasswordAuthMethod(authTypes: Set[AuthType]): AuthMethod = {
if (authTypes.contains(NONE)) AuthMethods.NONE
if (authTypes == Set(NOSASL)) AuthMethods.NONE
else if (authTypes.contains(NONE)) AuthMethods.NONE
else if (authTypes.contains(LDAP)) AuthMethods.LDAP
else if (authTypes.contains(JDBC)) AuthMethods.JDBC
else if (authTypes.contains(CUSTOM)) AuthMethods.CUSTOM
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ import org.apache.kyuubi.server.api.v1.ApiRootResource
import org.apache.kyuubi.server.http.authentication.{AuthenticationFilter, KyuubiHttpAuthenticationFactory}
import org.apache.kyuubi.server.ui.{JettyServer, JettyUtils}
import org.apache.kyuubi.service.{AbstractFrontendService, Serverable, Service, ServiceUtils}
import org.apache.kyuubi.service.authentication.{AuthTypes, KyuubiAuthenticationFactory}
import org.apache.kyuubi.service.authentication.AuthTypes.NONE
import org.apache.kyuubi.service.authentication.{AuthMethods, AuthTypes, KyuubiAuthenticationFactory}
import org.apache.kyuubi.session.{KyuubiSessionManager, SessionHandle}
import org.apache.kyuubi.util.ThreadUtils

Expand Down Expand Up @@ -73,7 +72,7 @@ class KyuubiRestFrontendService(override val serverable: Serverable)

private lazy val securityEnabled = {
val authTypes = conf.get(AUTHENTICATION_METHOD).map(AuthTypes.withName)
KyuubiAuthenticationFactory.getValidPasswordAuthMethod(authTypes) != NONE
KyuubiAuthenticationFactory.getValidPasswordAuthMethod(authTypes) != AuthMethods.NONE
}

private lazy val administrators: Set[String] =
Expand Down

0 comments on commit eaad093

Please sign in to comment.