You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@knox.apache.org by GitBox <gi...@apache.org> on 2020/06/09 16:18:37 UTC

[GitHub] [knox] pzampino commented on a change in pull request #341: KNOX-2383 - Checking token expiration in cache should not depend on the validate flag

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



##########
File path: gateway-server/src/main/java/org/apache/knox/gateway/services/token/impl/AliasBasedTokenStateService.java
##########
@@ -166,24 +166,21 @@ protected long getMaxLifetime(final String tokenId) {
 
   @Override
   public long getTokenExpiration(String tokenId, boolean validate) throws UnknownTokenException {
-    long expiration = 0;
-
-    if (!validate) {
-      // If validation is not required, then check the in-memory collection first
-      try {
-        expiration = super.getTokenExpiration(tokenId, validate);
-        return expiration;
-      } catch (UnknownTokenException e) {
-        // It's not in memory
-      }
+    if (validate) {

Review comment:
       I would keep this where it was previously, since the super will validate based on the in-memory store, and if it's not in-memory, only then do we want to validate the alias.




----------------------------------------------------------------
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:
users@infra.apache.org