moresandeep commented on a change in pull request #252: KNOX-2207 -
TokenStateService revocation should remove persisted token state
URL: https://github.com/apache/knox/pull/252#discussion_r375360758
##########
File path:
gateway-server/src/main/java/org/apache/knox/gateway/services/token/impl/DefaultTokenStateService.java
##########
@@ -168,15 +167,15 @@ public boolean isExpired(final JWTToken token) {
@Override
public boolean isExpired(final String token) {
- boolean isExpired;
+ boolean isUnknownToken;
- isExpired = isRevoked(token); // Check if it has been revoked first
- if (!isExpired) {
- // If it has not been revoked, check its expiration
- isExpired = (getTokenExpiration(token) <= System.currentTimeMillis());
+ isUnknownToken = isUnknown(token); // Check if the token exist
Review comment:
Actually, we cannot use validateToken(). validateToken() method throws an
exception and does not return a boolean value. So calls to isExpired() will now
start throwing exceptions. I could wrap validateToken() with try catch to get
better reuse the code.
----------------------------------------------------------------
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]
With regards,
Apache Git Services