Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KNOX-2207 - TokenStateService revocation should remove persisted token state #252

Merged

Conversation

moresandeep
Copy link
Contributor

What changes were proposed in this pull request?

Do not maintain state for revoked tokens.

How was this patch tested?

This patch was manually tested.

Please review Knox Contributing Process before opening a pull request.

@moresandeep moresandeep self-assigned this Feb 4, 2020
@@ -208,6 +205,18 @@ protected void updateExpiration(final String token, long expiration) {
}
}

protected void removeRevokedExpiredToken(final String token) {
if (!isValidIdentifier(token)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could just call validateToken() here?

@moresandeep
Copy link
Contributor Author

@pzampino addressed the review comments in new PR, let me know what you think.

Copy link
Contributor

@pzampino pzampino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The isExpired(String) implementation is confusing.
It could probably be as simple as:
validateToken(token);
return (getTokenExpiration(token) <= System.currentTimeMillis());

@moresandeep moresandeep merged commit 98e547f into apache:master Feb 5, 2020
aliasService.removeAliasForCluster(AliasService.NO_CLUSTER_NAME, token);
aliasService.removeAliasForCluster(AliasService.NO_CLUSTER_NAME,token + "--max");
} catch (AliasServiceException e) {
log.failedToUpdateTokenExpiration(e);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems a misleading log message

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I'll get it fixed, thanks for letting me know @smolnar82

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants