yuqi1129 commented on code in PR #8189:
URL: https://github.com/apache/gravitino/pull/8189#discussion_r2579397918
##########
iceberg/iceberg-common/src/main/java/org/apache/gravitino/iceberg/common/ClosableHiveCatalog.java:
##########
@@ -68,6 +112,135 @@ public void close() throws IOException {
});
}
+ @Override
+ public <R> R doKerberosOperations(Map<String, String> properties,
Executable<R> executable)
+ throws Throwable {
+
+ AuthenticationConfig authenticationConfig = new
AuthenticationConfig(properties);
+ if (!authenticationConfig.isKerberosAuth()) {
+ return executable.execute();
+ }
+
+ final String finalPrincipalName;
+ String proxyKerberosPrincipalName =
PrincipalUtils.getCurrentPrincipal().getName();
+
+ if (!proxyKerberosPrincipalName.contains("@")) {
+ finalPrincipalName =
+ String.format("%s@%s", proxyKerberosPrincipalName,
kerberosClient.getRealm());
+ } else {
+ finalPrincipalName = proxyKerberosPrincipalName;
+ }
+
+ UserGroupInformation realUser =
+ authenticationConfig.isImpersonationEnabled()
+ ? UserGroupInformation.createProxyUser(
+ finalPrincipalName, kerberosClient.getLoginUser())
+ : kerberosClient.getLoginUser();
Review Comment:
It will throw an exception if `initKerberosClient` fails, so there is no
problem here.
--
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]