lifangyu commented on code in PR #6923:
URL: https://github.com/apache/gravitino/pull/6923#discussion_r2058810407
##########
catalogs/catalog-lakehouse-hudi/src/main/java/org/apache/gravitino/catalog/lakehouse/hudi/backend/hms/HudiHMSBackendOps.java:
##########
@@ -236,12 +249,30 @@ private HiveConf buildHiveConf(Map<String, String>
properties) {
byPassConfigs.put(key.substring(CATALOG_BYPASS_PREFIX.length()),
value);
} else if (CONFIG_CONVERTER.containsKey(key)) {
convertedConfigs.put(CONFIG_CONVERTER.get(key), value);
+ } else {
+ hadoopConf.set(key, value);
}
});
byPassConfigs.forEach(hadoopConf::set);
- // Gravitino conf has higher priority than bypass conf
convertedConfigs.forEach(hadoopConf::set);
-
+ initKerberosAuth(properties, hadoopConf);
return new HiveConf(hadoopConf, HudiHMSBackendOps.class);
}
+
+ private void initKerberosAuth(Map<String, String> properties, Configuration
hadoopConf) {
+ AuthenticationConfig authenticationConfig = new
AuthenticationConfig(properties);
+ if (authenticationConfig.isKerberosAuth()) {
+ try (KerberosClient kerberosClient = new KerberosClient(properties,
hadoopConf, true)) {
+ String keytabPath =
+ String.format(
+ GRAVITINO_KEYTAB_FORMAT, Objects.isNull(this.info) ? "0" :
this.info.id());
+ File keytabFile = kerberosClient.saveKeyTabFileFromUri(keytabPath);
+ kerberosClient.login(keytabFile.getAbsolutePath());
+ LOG.info("Login with kerberos success");
+ return;
Review Comment:
Optimized!
--
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]