misutoth commented on a change in pull request #24421:
[SPARK-12312][SQL]Support Kerberos login in JDBC connector
URL: https://github.com/apache/spark/pull/24421#discussion_r307349711
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JdbcUtils.scala
##########
@@ -61,7 +65,23 @@ object JdbcUtils extends Logging {
throw new IllegalStateException(
s"Did not find registered driver with class $driverClass")
}
- val connection: Connection = driver.connect(options.url,
options.asConnectionProperties)
+
+ val connection: Connection = {
+ if (options.keytab != null && options.principal != null) {
+ val keytabFileName = FilenameUtils.getName(options.keytab)
+ UserGroupInformation
+ .loginUserFromKeytabAndReturnUGI(options.principal, keytabFileName)
+ .doAs(new PrivilegedAction[Connection] {
+ override def run(): Connection = {
+ driver.connect(options.url, options.asConnectionProperties)
+ }
+ })
+ }
+ else {
Review comment:
Seems there is no option for TGT nor delegation token. This later may be
useful for hadoop components though. But distributing the keytab is not the
most secure way and KDC may be overloaded.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]