[ 
https://issues.apache.org/jira/browse/KNOX-2212?focusedWorklogId=393755&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-393755
 ]

ASF GitHub Bot logged work on KNOX-2212:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 26/Feb/20 21:19
            Start Date: 26/Feb/20 21:19
    Worklog Time Spent: 10m 
      Work Description: moresandeep commented on pull request #274: KNOX-2212 - 
Token permissiveness
URL: https://github.com/apache/knox/pull/274#discussion_r384772404
 
 

 ##########
 File path: 
gateway-server/src/main/java/org/apache/knox/gateway/services/token/impl/DefaultTokenStateService.java
 ##########
 @@ -118,9 +125,17 @@ public void addToken(final String token,
   @Override
   public long getTokenExpiration(final String token) throws 
UnknownTokenException {
     long expiration;
-
-    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
 
 Review comment:
   Actually moving this code in a separate function would be more untidy 
(common code in this case would be just `validateToken(token)` and try catch). 
I don't like the fact that `validateToken(token)` throws an exception instead 
of returning `true` or `false` that would be a major change to do here. The 
main function that calculates JWT value `getJWTTokenExpiration(token)` is 
common for both implementation. Let me know if you still feel strongly about it.
 
----------------------------------------------------------------
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]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 393755)
    Time Spent: 1h 10m  (was: 1h)

> TokenStateService should fail permissively
> ------------------------------------------
>
>                 Key: KNOX-2212
>                 URL: https://issues.apache.org/jira/browse/KNOX-2212
>             Project: Apache Knox
>          Issue Type: Bug
>          Components: Server
>    Affects Versions: 1.4.0
>            Reporter: Philip Zampino
>            Assignee: Sandeep More
>            Priority: Major
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> While unlikely, it's possible that the TokenStateService may be presented 
> with a token, for which it has no state, but which can be verified as a valid 
> (origin, expiration, etc...) token. In these cases, rather than rejecting the 
> token for lack of server-managed state, the token's state should be recorded, 
> and the associated operation permitted.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to