Skip to content

Commit

Permalink
Bump django-oauth-toolkit from 2.4.0 to 3.0.1 (#1349)
Browse files Browse the repository at this point in the history
* Bump django-oauth-toolkit from 2.4.0 to 3.0.1

Bumps [django-oauth-toolkit](https://github.com/jazzband/django-oauth-toolkit) from 2.4.0 to 3.0.1.
- [Release notes](https://github.com/jazzband/django-oauth-toolkit/releases)
- [Changelog](https://github.com/jazzband/django-oauth-toolkit/blob/master/CHANGELOG.md)
- [Commits](jazzband/django-oauth-toolkit@2.4.0...3.0.1)

---
updated-dependencies:
- dependency-name: django-oauth-toolkit
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* add migration for AccessToken

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Julian B <[email protected]>
  • Loading branch information
dependabot[bot] and jeriox authored Sep 13, 2024
1 parent e38efff commit 41ce283
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Generated by Django 5.0.8 on 2024-09-12 20:15

import oauth2_provider.models
from django.db import migrations, models
from oauth2_provider.settings import oauth2_settings


def forwards_func(apps, schema_editor):
"""
Forward migration touches every "old" accesstoken.token which will cause the checksum to be computed.
Taken from https://github.com/jazzband/django-oauth-toolkit/pull/1491/
"""
AccessToken = apps.get_model(oauth2_settings.ACCESS_TOKEN_MODEL)
accesstokens = AccessToken._default_manager.all() # pylint: disable=protected-access
for accesstoken in accesstokens:
accesstoken.save(update_fields=["token_checksum"])


class Migration(migrations.Migration):

dependencies = [
("api", "0004_application_allowed_origins_and_more"),
]

operations = [
migrations.AddField(
model_name="accesstoken",
name="token_checksum",
field=oauth2_provider.models.TokenChecksumField(
default="", max_length=64, blank=True, null=True
),
preserve_default=False,
),
migrations.AddField(
model_name="refreshtoken",
name="token_family",
field=models.UUIDField(blank=True, editable=False, null=True),
),
migrations.AlterField(
model_name="accesstoken",
name="token",
field=models.TextField(),
),
migrations.RunPython(forwards_func, migrations.RunPython.noop),
migrations.AlterField(
model_name="accesstoken",
name="token_checksum",
field=oauth2_provider.models.TokenChecksumField(
blank=False, max_length=64, db_index=True, unique=True
),
),
]
15 changes: 7 additions & 8 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ django-filter = "^24.0"
djangorestframework-guardian = "^0.3.0"
uritemplate = "^4.1.1"
django-recurrence = "^1.11.1"
django-oauth-toolkit = "~2.4.0" # pinned because minor versions sometimes require migrations in our models
django-oauth-toolkit = "~3.0.1" # pinned because minor versions sometimes require migrations in our models
urllib3 = "^1.26.0,<2.0.0" # pinned because of uberspace issues with urllib3 2.0.0
pyyaml = "^6.0.1"
lxml = ">=4.9.3,<6.0.0"
Expand Down

0 comments on commit 41ce283

Please sign in to comment.