-
-
Notifications
You must be signed in to change notification settings - Fork 795
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement REFRESH_TOKEN_REUSE_PROTECTION (#1404)
According to https://datatracker.ietf.org/doc/html/draft-ietf-oauth-security-topics-29#name-recommendations, the authorization server needs a way to determine which refresh tokens belong to the same session, so it is able to figure out which tokens to revoke. Therefore, this commit introduces a "token_family" field to the RefreshToken table. Whenever a revoked refresh token is reused, the auth server uses the token family to revoke all related tokens.
- Loading branch information
Showing
6 changed files
with
89 additions
and
13 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
oauth2_provider/migrations/0011_refreshtoken_token_family.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 5.2 on 2024-08-09 16:40 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('oauth2_provider', '0010_application_allowed_origins'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='refreshtoken', | ||
name='token_family', | ||
field=models.UUIDField(blank=True, editable=False, null=True), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Generated by Django 5.2 on 2024-08-09 16:40 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('tests', '0005_basetestapplication_allowed_origins_and_more'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='samplerefreshtoken', | ||
name='token_family', | ||
field=models.UUIDField(blank=True, editable=False, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='basetestapplication', | ||
name='allowed_origins', | ||
field=models.TextField(blank=True, default='', help_text='Allowed origins list to enable CORS, space separated'), | ||
), | ||
migrations.AlterField( | ||
model_name='basetestapplication', | ||
name='post_logout_redirect_uris', | ||
field=models.TextField(blank=True, default='', help_text='Allowed Post Logout URIs list, space separated'), | ||
), | ||
migrations.AlterField( | ||
model_name='sampleaccesstoken', | ||
name='token', | ||
field=models.CharField(db_index=True, max_length=255, unique=True), | ||
), | ||
migrations.AlterField( | ||
model_name='sampleapplication', | ||
name='allowed_origins', | ||
field=models.TextField(blank=True, default='', help_text='Allowed origins list to enable CORS, space separated'), | ||
), | ||
migrations.AlterField( | ||
model_name='sampleapplication', | ||
name='post_logout_redirect_uris', | ||
field=models.TextField(blank=True, default='', help_text='Allowed Post Logout URIs list, space separated'), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters