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/02/25 22:23:15 UTC

[GitHub] [knox] moresandeep commented on a change in pull request #274: KNOX-2212 - Token permissiveness

moresandeep commented on a change in pull request #274: KNOX-2212 - Token permissiveness
URL: https://github.com/apache/knox/pull/274#discussion_r384162938
 
 

 ##########
 File path: gateway-server/src/main/java/org/apache/knox/gateway/services/token/impl/AliasBasedTokenStateService.java
 ##########
 @@ -92,9 +93,17 @@ protected long getMaxLifetime(final String token) {
   @Override
   public long getTokenExpiration(final String token) throws UnknownTokenException {
     long expiration = 0;
-
-    validateToken(token);
-
+    try {
+      validateToken(token);
+    } catch (final UnknownTokenException e) {
+      /* if token permissiveness is enabled we check JWT token expiration when the token state is unknown */
+      if (permissiveFailureEnabled && StringUtils
+          .containsIgnoreCase(e.toString(), "Unknown token")) {
 
 Review comment:
   Because this is how the validate() function let's you know that the TokenStateService does not have the token, by throwing UnknownTokenException.

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


With regards,
Apache Git Services