jerqi commented on code in PR #3852:
URL: https://github.com/apache/gravitino/pull/3852#discussion_r1679221853
##########
core/src/main/java/org/apache/gravitino/utils/PrincipalUtils.java:
##########
@@ -47,10 +47,19 @@ public static <T> T doAs(Principal principal,
PrivilegedExceptionAction<T> actio
public static Principal getCurrentPrincipal() {
java.security.AccessControlContext context =
java.security.AccessController.getContext();
Subject subject = Subject.getSubject(context);
- if (subject == null ||
subject.getPrincipals(UserPrincipal.class).isEmpty()) {
+ if (subject == null) {
return new UserPrincipal(AuthConstants.ANONYMOUS_USER);
}
- return subject.getPrincipals(UserPrincipal.class).iterator().next();
+
+ if (!subject.getPrincipals(UserPrincipal.class).isEmpty()) {
+ return subject.getPrincipals(UserPrincipal.class).iterator().next();
+ }
+
+ if (!subject.getPrincipals().isEmpty()) {
+ return new
UserPrincipal(subject.getPrincipals().iterator().next().getName());
Review Comment:
This logic isn't right. Why do we need this?
--
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]