pzampino commented on a change in pull request #440:
URL: https://github.com/apache/knox/pull/440#discussion_r623364195



##########
File path: 
gateway-provider-security-jwt/src/main/java/org/apache/knox/gateway/provider/federation/jwt/filter/AbstractJWTFilter.java
##########
@@ -444,41 +420,41 @@ protected boolean verifyTokenSignature(final JWT token) {
         }
       }
 
-      if (verified && tokenId != null) { // If successful, record the 
verification for future reference
-        recordSignatureVerification(tokenId);
+      if (verified) { // If successful, record the verification for future 
reference
+        recordSignatureVerification(serializedJWT);
       }
     }
 
     return verified;
   }
 
   /**
-   * Determine if the specified token signature has previously been 
successfully verified.
+   * Determine if the specified JWT signature has previously been successfully 
verified.
    *
-   * @param tokenId The unique identifier for a token.
+   * @param jwt A serialized JWT String.
    *
    * @return true, if the specified token has been previously verified; 
Otherwise, false.
    */
-  protected boolean hasSignatureBeenVerified(final String tokenId) {
-    return (verifiedTokens.getIfPresent(tokenId) != null);
+  protected boolean hasSignatureBeenVerified(final String jwt) {
+    return verifiedTokens.hasSignatureBeenVerified(jwt);
   }
 
   /**
-   * Record a successful token signature verification.
+   * Record a successful JWT signature verification.
    *
-   * @param tokenId The unique identifier for the token which has been 
successfully verified.
+   * @param jwt The serialized String for a JWT which has been successfully 
verified.
    */
-  protected void recordSignatureVerification(final String tokenId) {
-    verifiedTokens.put(tokenId, true);
+  protected void recordSignatureVerification(final String jwt) {

Review comment:
       I had originally removed the delegating method, but it currently 
facilitate testing, so I've chosen to leave it for now.

##########
File path: 
gateway-provider-security-jwt/src/main/java/org/apache/knox/gateway/provider/federation/jwt/filter/AbstractJWTFilter.java
##########
@@ -444,41 +420,41 @@ protected boolean verifyTokenSignature(final JWT token) {
         }
       }
 
-      if (verified && tokenId != null) { // If successful, record the 
verification for future reference
-        recordSignatureVerification(tokenId);
+      if (verified) { // If successful, record the verification for future 
reference
+        recordSignatureVerification(serializedJWT);
       }
     }
 
     return verified;
   }
 
   /**
-   * Determine if the specified token signature has previously been 
successfully verified.
+   * Determine if the specified JWT signature has previously been successfully 
verified.
    *
-   * @param tokenId The unique identifier for a token.
+   * @param jwt A serialized JWT String.
    *
    * @return true, if the specified token has been previously verified; 
Otherwise, false.
    */
-  protected boolean hasSignatureBeenVerified(final String tokenId) {
-    return (verifiedTokens.getIfPresent(tokenId) != null);
+  protected boolean hasSignatureBeenVerified(final String jwt) {
+    return verifiedTokens.hasSignatureBeenVerified(jwt);
   }
 
   /**
-   * Record a successful token signature verification.
+   * Record a successful JWT signature verification.
    *
-   * @param tokenId The unique identifier for the token which has been 
successfully verified.
+   * @param jwt The serialized String for a JWT which has been successfully 
verified.
    */
-  protected void recordSignatureVerification(final String tokenId) {
-    verifiedTokens.put(tokenId, true);
+  protected void recordSignatureVerification(final String jwt) {
+    verifiedTokens.recordSignatureVerification(jwt);
   }
 
   /**
-   * Explicitly evict the signature verification record from the cache if it 
exists.
+   * Explicitly evict the signature verification record for the specified JWT 
from the cache if it exists.
    *
-   * @param tokenId The token whose signature verification record should be 
evicted.
+   * @param jwt The serialized String for a JWT whose signature verification 
record should be evicted.
    */
-  protected void removeSignatureVerificationRecord(final String tokenId) {
-    verifiedTokens.asMap().remove(tokenId);
+  protected void removeSignatureVerificationRecord(final String jwt) {

Review comment:
       I had originally removed the delegating method, but it currently 
facilitate testing, so I've chosen to leave it for now.




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to