This is an automated email from the ASF dual-hosted git repository.
jshao pushed a commit to branch branch-0.8
in repository https://gitbox.apache.org/repos/asf/gravitino.git
The following commit(s) were added to refs/heads/branch-0.8 by this push:
new cd44ee49be [#6777] fix(server,authn): Fix use catalog and show
databases failed with krb cluster issue (#6876)
cd44ee49be is described below
commit cd44ee49be15934dfa16c93e5658aa27973e9da1
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Thu Apr 10 10:33:25 2025 -0700
[#6777] fix(server,authn): Fix use catalog and show databases failed with
krb cluster issue (#6876)
### What changes were proposed in this pull request?
Fix use catalog and show databases failed with krb cluster issue
### Why are the changes needed?
Fix: #6777
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
local test.
Co-authored-by: gavin.wang <[email protected]>
---
.../java/org/apache/gravitino/catalog/hive/HiveProxyPlugin.java | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git
a/catalogs/catalog-hive/src/main/java/org/apache/gravitino/catalog/hive/HiveProxyPlugin.java
b/catalogs/catalog-hive/src/main/java/org/apache/gravitino/catalog/hive/HiveProxyPlugin.java
index a7c47a6d7f..760a91deb2 100644
---
a/catalogs/catalog-hive/src/main/java/org/apache/gravitino/catalog/hive/HiveProxyPlugin.java
+++
b/catalogs/catalog-hive/src/main/java/org/apache/gravitino/catalog/hive/HiveProxyPlugin.java
@@ -60,19 +60,22 @@ class HiveProxyPlugin implements ProxyPlugin {
// The http authentication use one KDC server, the Hive catalog may
use another KDC server.
// The KerberosAuthenticator will remove realm of principal.
// And then we add the realm of Hive catalog to the user.
+ final String finalPrincipalName;
String proxyKerberosPrincipalName = principal.getName();
if (!proxyKerberosPrincipalName.contains("@")) {
- proxyKerberosPrincipalName =
+ finalPrincipalName =
String.format("%s@%s", proxyKerberosPrincipalName,
ops.getKerberosRealm());
+ } else {
+ finalPrincipalName = proxyKerberosPrincipalName;
}
- proxyUser =
UserGroupInformation.createProxyUser(proxyKerberosPrincipalName, realUser);
+ proxyUser = UserGroupInformation.createProxyUser(finalPrincipalName,
realUser);
String token =
ops.getClientPool()
.run(
client -> {
- return client.getDelegationToken(principal.getName(),
realUser.getUserName());
+ return client.getDelegationToken(finalPrincipalName,
realUser.getUserName());
});
Token<DelegationTokenIdentifier> delegationToken = new
Token<DelegationTokenIdentifier>();