Uploaded image for project: 'Apache Knox'
  1. Apache Knox
  2. KNOX-2670

AliasBasedTokenStateService does not throw UnknownTokenException at revocation time

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.6.0
    • 1.6.0
    • None
    • None

    Description

      Steps to reproduce

      1. Configure Knox to use the AliasBasedTokenStateService implemntation
      2. Generated token with 1 min lifespan on the token generation UI
      3. Revoke the token on the token management page
      4. 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.

      Attachments

        Activity

          People

            smolnar Sandor Molnar
            smolnar Sandor Molnar
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 20m
                20m