Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
1.6.0
-
None
-
None
Description
Steps to reproduce
- Configure Knox to use the AliasBasedTokenStateService implemntation
- Generated token with 1 min lifespan on the token generation UI
- Revoke the token on the token management page
- Use knox token api to revoke again the already revoked token
The result is:
{ "revoked": "true" }
Root cause analysis
AliasBasedTokenStateService.removeToken(String tokenId) claims it throws UnknownTokenException but this is not true since it's missing the validateToken(String) call. In fact, we would not even need that method: if we remove it then DefaultTokenStateService.removeToken(String) will be invoked that has the required check.
The good news is that the token is not maintained in the memory or in the underlying keystore because AliasBasedTokenStateService.removeToken(Set<String> tokenIds) silently tries to remove the token from the keystore and from memory but those implementations are tolerant to invoke a delete with a non-existing alias.
That means, the token was removed perfectly for the first time.