jerqi commented on code in PR #9788:
URL: https://github.com/apache/gravitino/pull/9788#discussion_r2734581228
##########
server-common/src/main/java/org/apache/gravitino/server/authentication/StaticSignKeyValidator.java:
##########
@@ -107,6 +123,23 @@ public Principal validateToken(String token, String
serviceAudience) {
}
}
+ /** Extracts the principal from the JWT claims using configured field(s). */
+ private String extractPrincipal(Claims claims) {
+ // Try the principal field(s) one by one in order
+ if (principalFields != null && !principalFields.isEmpty()) {
+ for (String field : principalFields) {
+ if (StringUtils.isNotBlank(field)) {
+ Object claimValue = claims.get(field);
+ if (claimValue != null) {
+ return claimValue.toString();
+ }
+ }
+ }
+ }
+
+ return null;
Review Comment:
throw exception directly 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]