Skip to content

Commit 91b97d0

Browse files
committed
Merge branch 'master' into login_not_required
2 parents 53f2888 + 146e8bf commit 91b97d0

File tree

14 files changed

+33
-64
lines changed

14 files changed

+33
-64
lines changed

.github/workflows/test.yml

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,41 +10,20 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
python-version:
13-
# - '3.8'
14-
# - '3.9'
1513
- '3.10'
1614
- '3.11'
1715
- '3.12'
1816
django-version:
19-
# - '3.2'
20-
# - '4.0'
21-
# - '4.1'
2217
- '4.2'
2318
- '5.0'
2419
- '5.1'
2520
- 'main'
26-
# exclude:
21+
include:
2722
# https://docs.djangoproject.com/en/dev/faq/install/#what-python-version-can-i-use-with-django
28-
29-
# < Python 3.10 is not supported by Django 5.0+
30-
# - python-version: '3.8'
31-
# django-version: '5.0'
32-
# - python-version: '3.9'
33-
# django-version: '5.0'
34-
# - python-version: '3.8'
35-
# django-version: 'main'
36-
# - python-version: '3.9'
37-
# django-version: 'main'
38-
39-
# # Python 3.12 is not supported by Django < 5.0
40-
# - python-version: '3.12'
41-
# django-version: '3.2'
42-
# - python-version: '3.12'
43-
# django-version: '4.0'
44-
# - python-version: '3.12'
45-
# django-version: '4.1'
46-
# - python-version: '3.12'
47-
# django-version: '4.2'
23+
- python-version: '3.8'
24+
django-version: '4.2'
25+
- python-version: '3.9'
26+
django-version: '4.2'
4827

4928
steps:
5029
- uses: actions/checkout@v4

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ Rustem Saiargaliev
104104
Sandro Rodrigues
105105
Shaheed Haque
106106
Shaun Stanworth
107+
Sayyid Hamid Mahdavi
107108
Silvano Cerza
108109
Sora Yanai
109110
Sören Wegener

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2121
* #1404 Add a new setting `REFRESH_TOKEN_REUSE_PROTECTION`
2222
### Changed
2323
* Update token to TextField from CharField with 255 character limit and SHA-256 checksum in AbstractAccessToken model. Removing the 255 character limit enables supporting JWT tokens with additional claims
24-
2524
* Update middleware, validators, and views to use token checksums instead of token for token retrieval and validation.
25+
* #1446 use generic models pk instead of id.
26+
2627
### Deprecated
2728
### Removed
2829
* #1425 Remove deprecated `RedirectURIValidator`, `WildcardSet` per #1345; `validate_logout_request` per #1274
30+
* Remove support for Django versions below 4.2
2931

3032
### Fixed
3133
* #1443 Query strings with invalid hex values now raise a SuspiciousOperation exception (in DRF extension) instead of raising a 500 ValueError: Invalid hex encoding in query string.

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Requirements
4444
------------
4545

4646
* Python 3.8+
47-
* Django 3.2, 4.0 (4.0.1+ due to a regression), 4.1, 4.2, or 5.0
47+
* Django 4.2, 5.0 or 5.1
4848
* oauthlib 3.1+
4949

5050
Installation

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Requirements
2222
------------
2323

2424
* Python 3.8+
25-
* Django 3.2, 4.0 (4.0.1+ due to a regression), 4.1, 4.2, or 5.0
25+
* Django 4.2, 5.0 or 5.1
2626
* oauthlib 3.1+
2727

2828
Index

oauth2_provider/admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020

2121
class ApplicationAdmin(admin.ModelAdmin):
22-
list_display = ("id", "name", "user", "client_type", "authorization_grant_type")
22+
list_display = ("pk", "name", "user", "client_type", "authorization_grant_type")
2323
list_filter = ("client_type", "authorization_grant_type", "skip_authorization")
2424
radio_fields = {
2525
"client_type": admin.HORIZONTAL,

oauth2_provider/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ def clean(self):
244244
raise ValidationError(_("You cannot use HS256 with public grants or clients"))
245245

246246
def get_absolute_url(self):
247-
return reverse("oauth2_provider:detail", args=[str(self.id)])
247+
return reverse("oauth2_provider:detail", args=[str(self.pk)])
248248

249249
def get_allowed_schemes(self):
250250
"""
@@ -520,7 +520,7 @@ def revoke(self):
520520
self = list(token)[0]
521521

522522
try:
523-
access_token_model.objects.get(id=self.access_token_id).revoke()
523+
access_token_model.objects.get(pk=self.access_token_id).revoke()
524524
except access_token_model.DoesNotExist:
525525
pass
526526
self.access_token = None

oauth2_provider/oauth2_validators.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ def save_bearer_token(self, token, request, *args, **kwargs):
622622
# from the db while acquiring a lock on it
623623
# We also put it in the "request cache"
624624
refresh_token_instance = RefreshToken.objects.select_for_update().get(
625-
id=refresh_token_instance.id
625+
pk=refresh_token_instance.pk
626626
)
627627
request.refresh_token_instance = refresh_token_instance
628628

@@ -756,7 +756,7 @@ def get_original_scopes(self, refresh_token, request, *args, **kwargs):
756756
rt = request.refresh_token_instance
757757
if not rt.access_token_id:
758758
try:
759-
return AccessToken.objects.get(source_refresh_token_id=rt.id).scope
759+
return AccessToken.objects.get(source_refresh_token_id=rt.pk).scope
760760
except AccessToken.DoesNotExist:
761761
return []
762762
return rt.access_token.scope
@@ -810,9 +810,9 @@ def get_jwt_bearer_token(self, token, token_handler, request):
810810

811811
def get_claim_dict(self, request):
812812
if self._get_additional_claims_is_request_agnostic():
813-
claims = {"sub": lambda r: str(r.user.id)}
813+
claims = {"sub": lambda r: str(r.user.pk)}
814814
else:
815-
claims = {"sub": str(request.user.id)}
815+
claims = {"sub": str(request.user.pk)}
816816

817817
# https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims
818818
if self._get_additional_claims_is_request_agnostic():

oauth2_provider/templates/oauth2_provider/application_detail.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ <h3 class="block-center-heading">{{ application.name }}</h3>
4949

5050
<div class="btn-toolbar">
5151
<a class="btn" href="{% url "oauth2_provider:list" %}">{% trans "Go Back" %}</a>
52-
<a class="btn btn-primary" href="{% url "oauth2_provider:update" application.id %}">{% trans "Edit" %}</a>
53-
<a class="btn btn-danger" href="{% url "oauth2_provider:delete" application.id %}">{% trans "Delete" %}</a>
52+
<a class="btn btn-primary" href="{% url "oauth2_provider:update" application.pk %}">{% trans "Edit" %}</a>
53+
<a class="btn btn-danger" href="{% url "oauth2_provider:delete" application.pk %}">{% trans "Delete" %}</a>
5454
</div>
5555
</div>
5656
{% endblock content %}

oauth2_provider/templates/oauth2_provider/application_form.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{% load i18n %}
44
{% block content %}
55
<div class="block-center">
6-
<form class="form-horizontal" method="post" action="{% block app-form-action-url %}{% url 'oauth2_provider:update' application.id %}{% endblock app-form-action-url %}">
6+
<form class="form-horizontal" method="post" action="{% block app-form-action-url %}{% url 'oauth2_provider:update' application.pk %}{% endblock app-form-action-url %}">
77
<h3 class="block-center-heading">
88
{% block app-form-title %}
99
{% trans "Edit application" %} {{ application.name }}
@@ -31,7 +31,7 @@ <h3 class="block-center-heading">
3131

3232
<div class="control-group">
3333
<div class="controls">
34-
<a class="btn" href="{% block app-form-back-url %}{% url "oauth2_provider:detail" application.id %}{% endblock app-form-back-url %}">
34+
<a class="btn" href="{% block app-form-back-url %}{% url "oauth2_provider:detail" application.pk %}{% endblock app-form-back-url %}">
3535
{% trans "Go Back" %}
3636
</a>
3737
<button type="submit" class="btn btn-primary">{% trans "Save" %}</button>

0 commit comments

Comments
 (0)