Adds new refresh tokens to OutstandingToken db. #866
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.
Fixes the issue #363 where new refresh tokens issued out do not get added to the OutstandingToken db.
The issue was resolved by adding a method to the
Token
class calledoutstand
, which checks if the token is in the outstanding table, and adds it if not.When
ROTATE_REFRESH_TOKENS
is set toTrue
, theTokenRefreshSerializer
calls the.outstand()
method on the new refresh token that is issued.All tests ran fine, except for test
test_it_should_blacklist_refresh_token_if_tokens_should_be_rotated_and_blacklisted
. The reason for this was it was asserting that outstanding table has1
token.However, since this bug is now fixed, there should be in fact
2
tokens in the outstanding table. One for the initial refresh token issued during authentication, and the second token which is issued during a refresh, which was implemented in this PR with.outstand()
. So I have changed that test to assert two tokens in the table, which is now correct.