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

Adds new refresh tokens to OutstandingToken db. #866

Conversation

thecarpetjasp
Copy link
Contributor

@thecarpetjasp thecarpetjasp commented Feb 20, 2025

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 called outstand, which checks if the token is in the outstanding table, and adds it if not.

When ROTATE_REFRESH_TOKENS is set to True, the TokenRefreshSerializer 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 has 1 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.

@thecarpetjasp thecarpetjasp merged commit b962aca into jazzband:master Feb 21, 2025
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants