zhouyifan279 commented on issue #5411:
URL: https://github.com/apache/kyuubi/issues/5411#issuecomment-1769866126
From what I understood, we are discussing 2 problems:
1. Can not authenticate with Kyuubi Server using proxy user and subject
auth mode
2. Make auth mode configs more user friendly
For Problem 1, we can use proxy user to authenticate using following code:
```
val remoteUser: UserGroupInformation = ...
val isProxyUser = remoteUser.getAuthenticationMethod() ==
UserGroupInformation.AuthenticationMethod.PROXY
val realUser = if (isProxyUser) {
remoteUser.getRealUser()
} else {
remoteUser
}
val connection = realUser.doAs(new PrivilegedExceptionAction[Connection]() {
override def run(): Connection = {
val url = if (isProxyUser) {
"jdbc:hive2://....;hive.server2.proxy.user=" +
remoteUser.getShortUserName()
} else {
"jdbc:hive2://....;"
}
DriverManager.getConnection(url)
}
})
```
As Kyuubi Hive Jdbc tries to not include hadoop dependencies, I suggest not
put the above code into Kyuubi.
For Problem 2, I agree that the authentication configs inherited from Hive
is hard to understand. I vote +1 for the refactoring as long as it keeps to
support current configs.
--
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]