JoegenUSTC commented on code in PR #11355:
URL: https://github.com/apache/gravitino/pull/11355#discussion_r3353893493
##########
catalogs/hive-metastore-common/src/main/java/org/apache/gravitino/hive/kerberos/KerberosClient.java:
##########
@@ -198,4 +198,15 @@ public void close() {
public void setHiveClient(HiveClient client) {
this.hiveClient = client;
}
+
+ /**
+ * Returns the real (non-proxy) {@link UserGroupInformation} that was
obtained after Kerberos
+ * login via keytab. Used by callers that need to bind the JAAS Subject to
the current thread
+ * (e.g., via {@code ugi.doAs(...)}) before performing a Kerberos-protected
RPC call.
+ *
+ * @return the real login UGI, or {@code null} if {@link #login()} has not
been called yet.
+ */
+ public UserGroupInformation getRealLoginUgi() {
+ return realLoginUgi;
+ }
Review Comment:
Implemented as suggested. The check is placed inside `getRealLoginUgi()`
rather than
at the call site in `HiveClientFactory`, which makes the contract clearer
and avoids
having every caller guard against null independently.
--
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]