JWT Blacklisting, Token Revocation #307
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As a part of another PR it was noted that the
EndImpersonation
handler did nothing but log the request for ending the session, but didn't actually do anything - after thinking through this, I realized that one of the underlying lacking capabilities available in this library would be JWT Blacklisting + token revocation. Because we cannot modify a jwt after it's been issued (e.g. like expire the issued token) the available method(s) to initiate a revocation and stop the use of the token is to leverage what's called a "blacklist" (the alternative being a whitelist). Because the list of tokens we'd actually force-revoke should always be relatively small, it's not a ton of overhead add verification checks to our code to ensure it's not a part of the blacklist. The inverse method would be to track all issued, valid, tokens and confirm the token is inside of that last list which seemed to have much more strict data durability requirements than a blacklist since in a blacklist situation, if our redis cache were down, we can fall back to the fact the issued token will naturally age out (and should have a short life to begin with). In addition to blacklisting capabilities, this PR also:MustRefreshTokenFromContext
to use correct typeNewCookie()
implementation and cut the existing lines of code in ~halfOther misc:
assert
in preference overrequire
in tests