dimas-b commented on code in PR #2389:
URL: https://github.com/apache/polaris/pull/2389#discussion_r2353053275


##########
runtime/service/src/main/java/org/apache/polaris/service/auth/JWTBroker.java:
##########
@@ -60,34 +58,22 @@ public abstract class JWTBroker implements TokenBroker {
   public abstract Algorithm getAlgorithm();
 
   @Override
-  public DecodedToken verify(String token) {
+  public PolarisCredential verify(String token) {
+    return verifyInternal(token);
+  }
+
+  private InternalPolarisToken verifyInternal(String token) {
     JWTVerifier verifier = 
JWT.require(getAlgorithm()).withClaim(CLAIM_KEY_ACTIVE, true).build();
 
     try {
       DecodedJWT decodedJWT = verifier.verify(token);
-      return new DecodedToken() {
-        @Override
-        public Long getPrincipalId() {
-          return decodedJWT.getClaim("principalId").asLong();
-        }
-
-        @Override
-        public String getClientId() {
-          return decodedJWT.getClaim("client_id").asString();
-        }
-
-        @Override
-        public String getSub() {
-          return decodedJWT.getSubject();
-        }
-
-        @Override
-        public String getScope() {
-          return decodedJWT.getClaim("scope").asString();
-        }
-      };
-
-    } catch (JWTVerificationException e) {
+      return InternalPolarisToken.of(
+          decodedJWT.getSubject(),
+          decodedJWT.getClaim(CLAIM_KEY_PRINCIPAL_ID).asLong(),

Review Comment:
   I might have missed it, but where is this claim set (in issued tokens)?



-- 
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]

Reply via email to