pan3793 commented on code in PR #6608:
URL: https://github.com/apache/kyuubi/pull/6608#discussion_r1719220391
##########
kyuubi-common/src/main/scala/org/apache/kyuubi/service/authentication/AuthenticationProviderFactory.scala:
##########
@@ -62,4 +64,30 @@ object AuthenticationProviderFactory {
new AnonymousAuthenticationProviderImpl
}
}
+
+ def getHttpBasicAuthenticationProvider(
+ method: AuthMethod,
+ conf: KyuubiConf): PasswdAuthenticationProvider = method match {
+ case AuthMethods.NONE => new AnonymousAuthenticationProviderImpl
+ case AuthMethods.LDAP => new LdapAuthenticationProviderImpl(conf)
+ case AuthMethods.JDBC => new JdbcAuthenticationProviderImpl(conf)
+ case AuthMethods.CUSTOM =>
+ val className = conf.get(KyuubiConf.AUTHENTICATION_CUSTOM_BASIC_CLASS)
+ if (className.isEmpty) {
+ throw new AuthenticationException(
+ "authentication.custom.basic.class must be set for http basic
authentication.")
+ }
Review Comment:
this is caused by admin's wrong configuration, should not throw
`AuthenticationException`
```
require(className.nonEmpty, "xxxxx")
```
please correct the mentioned configuration key
`authentication.custom.basic.class` =>
`kyuubi.authentication.custom.basic.class`
##########
kyuubi-common/src/main/scala/org/apache/kyuubi/service/authentication/AuthenticationProviderFactory.scala:
##########
@@ -62,4 +64,30 @@ object AuthenticationProviderFactory {
new AnonymousAuthenticationProviderImpl
}
}
+
+ def getHttpBasicAuthenticationProvider(
+ method: AuthMethod,
+ conf: KyuubiConf): PasswdAuthenticationProvider = method match {
+ case AuthMethods.NONE => new AnonymousAuthenticationProviderImpl
+ case AuthMethods.LDAP => new LdapAuthenticationProviderImpl(conf)
+ case AuthMethods.JDBC => new JdbcAuthenticationProviderImpl(conf)
+ case AuthMethods.CUSTOM =>
+ val className = conf.get(KyuubiConf.AUTHENTICATION_CUSTOM_BASIC_CLASS)
+ if (className.isEmpty) {
+ throw new AuthenticationException(
+ "authentication.custom.basic.class must be set for http basic
authentication.")
+ }
+ ClassUtils.createInstance(className.get,
classOf[PasswdAuthenticationProvider], conf)
+ case _ => throw new AuthenticationException("Not a valid authentication
method")
+ }
+
+ def getHttpBearerAuthenticationProvider(
+ providerClass: String,
+ conf: KyuubiConf): TokenAuthenticationProvider = {
+ if (StringUtils.isBlank(providerClass)) {
+ throw new AuthenticationException(
+ "authentication.custom.bearer.class must be set for http bearer
authentication.")
Review Comment:
ditto
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]