django-oauth-toolkit 2.3.0__tar.gz → 2.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/AUTHORS +19 -0
- {django-oauth-toolkit-2.3.0/django_oauth_toolkit.egg-info → django_oauth_toolkit-2.4.0}/PKG-INFO +12 -6
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/README.rst +3 -3
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0/django_oauth_toolkit.egg-info}/PKG-INFO +12 -6
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/django_oauth_toolkit.egg-info/SOURCES.txt +6 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/django_oauth_toolkit.egg-info/requires.txt +2 -1
- django_oauth_toolkit-2.4.0/oauth2_provider/__init__.py +1 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/contrib/rest_framework/permissions.py +1 -1
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/generators.py +1 -1
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/management/commands/createapplication.py +8 -1
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/middleware.py +25 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/migrations/0006_alter_application_client_secret.py +15 -2
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/migrations/0007_application_post_logout_redirect_uris.py +1 -1
- django_oauth_toolkit-2.4.0/oauth2_provider/migrations/0008_alter_accesstoken_token.py +17 -0
- django_oauth_toolkit-2.4.0/oauth2_provider/migrations/0009_add_hash_client_secret.py +18 -0
- django_oauth_toolkit-2.4.0/oauth2_provider/migrations/0010_application_allowed_origins.py +22 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/models.py +56 -6
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/oauth2_backends.py +5 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/oauth2_validators.py +55 -16
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/settings.py +5 -2
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/templates/oauth2_provider/application_detail.html +15 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/urls.py +5 -1
- django_oauth_toolkit-2.4.0/oauth2_provider/utils.py +34 -0
- django_oauth_toolkit-2.4.0/oauth2_provider/validators.py +111 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/views/application.py +6 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/views/base.py +29 -2
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/views/generic.py +2 -5
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/views/introspect.py +1 -1
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/views/mixins.py +0 -1
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/views/oidc.py +99 -13
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/views/token.py +1 -1
- django_oauth_toolkit-2.4.0/pyproject.toml +17 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/setup.cfg +5 -3
- django_oauth_toolkit-2.4.0/tests/test_application_views.py +133 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/tests/test_auth_backends.py +66 -18
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/tests/test_authorization_code.py +114 -23
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/tests/test_client_credential.py +12 -15
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/tests/test_decorators.py +9 -11
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/tests/test_hybrid.py +15 -16
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/tests/test_implicit.py +15 -17
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/tests/test_introspection_auth.py +95 -31
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/tests/test_introspection_view.py +19 -23
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/tests/test_models.py +84 -32
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/tests/test_oauth2_backends.py +18 -21
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/tests/test_oauth2_validators.py +46 -8
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/tests/test_oidc_views.py +165 -8
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/tests/test_password.py +8 -11
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/tests/test_rest_framework.py +9 -8
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/tests/test_scopes.py +8 -11
- django_oauth_toolkit-2.4.0/tests/test_token_endpoint_cors.py +160 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/tests/test_token_revocation.py +8 -11
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/tests/test_token_view.py +6 -9
- django_oauth_toolkit-2.4.0/tests/test_utils.py +27 -0
- django_oauth_toolkit-2.4.0/tests/test_validators.py +266 -0
- django-oauth-toolkit-2.3.0/oauth2_provider/__init__.py +0 -7
- django-oauth-toolkit-2.3.0/oauth2_provider/validators.py +0 -46
- django-oauth-toolkit-2.3.0/pyproject.toml +0 -10
- django-oauth-toolkit-2.3.0/tests/test_application_views.py +0 -101
- django-oauth-toolkit-2.3.0/tests/test_validators.py +0 -63
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/LICENSE +0 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/MANIFEST.in +0 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/django_oauth_toolkit.egg-info/dependency_links.txt +0 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/django_oauth_toolkit.egg-info/not-zip-safe +0 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/django_oauth_toolkit.egg-info/top_level.txt +0 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/admin.py +0 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/apps.py +0 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/backends.py +0 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/compat.py +0 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/contrib/__init__.py +0 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/contrib/rest_framework/__init__.py +0 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/contrib/rest_framework/authentication.py +0 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/decorators.py +0 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/exceptions.py +0 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/forms.py +0 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/http.py +0 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/management/__init__.py +0 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/management/commands/__init__.py +0 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/management/commands/cleartokens.py +0 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/migrations/0001_initial.py +0 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/migrations/0002_auto_20190406_1805.py +0 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/migrations/0003_auto_20201211_1314.py +0 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/migrations/0004_auto_20200902_2022.py +0 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/migrations/0005_auto_20211222_2352.py +0 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/migrations/__init__.py +0 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/scopes.py +0 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/signals.py +0 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/templates/oauth2_provider/application_confirm_delete.html +0 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/templates/oauth2_provider/application_form.html +0 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/templates/oauth2_provider/application_list.html +0 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/templates/oauth2_provider/application_registration_form.html +0 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/templates/oauth2_provider/authorize.html +0 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/templates/oauth2_provider/authorized-token-delete.html +0 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/templates/oauth2_provider/authorized-tokens.html +0 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/templates/oauth2_provider/base.html +0 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/templates/oauth2_provider/logout_confirm.html +0 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/views/__init__.py +0 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/setup.py +0 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/tests/test_commands.py +0 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/tests/test_generator.py +0 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/tests/test_mixins.py +0 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/tests/test_scopes_backend.py +0 -0
- {django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/tests/test_settings.py +0 -0
|
@@ -9,26 +9,33 @@ Contributors
|
|
|
9
9
|
|
|
10
10
|
Abhishek Patel
|
|
11
11
|
Adam Johnson
|
|
12
|
+
Adam Zahradník
|
|
12
13
|
Adheeth P Praveen
|
|
13
14
|
Alan Crosswell
|
|
15
|
+
Alan Rominger
|
|
14
16
|
Alejandro Mantecon Guillen
|
|
15
17
|
Aleksander Vaskevich
|
|
16
18
|
Alessandro De Angelis
|
|
19
|
+
Alex Manning
|
|
17
20
|
Alex Szabó
|
|
21
|
+
Aliaksei Kanstantsinau
|
|
18
22
|
Allisson Azevedo
|
|
19
23
|
Andrea Greco
|
|
20
24
|
Andrej Zbín
|
|
21
25
|
Andrew Chen Wang
|
|
26
|
+
Andrew Zickler
|
|
22
27
|
Antoine Laurent
|
|
23
28
|
Anvesh Agarwal
|
|
24
29
|
Aristóbulo Meneses
|
|
25
30
|
Aryan Iyappan
|
|
31
|
+
Asaf Klibansky
|
|
26
32
|
Ash Christopher
|
|
27
33
|
Asif Saif Uddin
|
|
28
34
|
Bart Merenda
|
|
29
35
|
Bas van Oostveen
|
|
30
36
|
Brian Helba
|
|
31
37
|
Carl Schwan
|
|
38
|
+
Daniel Golding
|
|
32
39
|
Daniel 'Vector' Kerr
|
|
33
40
|
Darrel O'Pry
|
|
34
41
|
Dave Burkholder
|
|
@@ -45,16 +52,21 @@ Eduardo Oliveira
|
|
|
45
52
|
Egor Poderiagin
|
|
46
53
|
Emanuele Palazzetti
|
|
47
54
|
Federico Dolce
|
|
55
|
+
Florian Demmer
|
|
48
56
|
Frederico Vieira
|
|
57
|
+
Gaël Utard
|
|
58
|
+
Glauco Junior
|
|
49
59
|
Hasan Ramezani
|
|
50
60
|
Hiroki Kiyohara
|
|
51
61
|
Hossein Shakiba
|
|
52
62
|
Islam Kamel
|
|
63
|
+
Ivan Lukyanets
|
|
53
64
|
Jadiel Teófilo
|
|
54
65
|
Jens Timmerman
|
|
55
66
|
Jerome Leclanche
|
|
56
67
|
Jesse Gibbs
|
|
57
68
|
Jim Graham
|
|
69
|
+
John Byrne
|
|
58
70
|
Jonas Nygaard Pedersen
|
|
59
71
|
Jonathan Steffan
|
|
60
72
|
Jordi Sanchez
|
|
@@ -66,7 +78,9 @@ Julien Palard
|
|
|
66
78
|
Jun Zhou
|
|
67
79
|
Kaleb Porter
|
|
68
80
|
Kristian Rune Larsen
|
|
81
|
+
Lazaros Toumanidis
|
|
69
82
|
Ludwig Hähne
|
|
83
|
+
Łukasz Skarżyński
|
|
70
84
|
Marcus Sonestedt
|
|
71
85
|
Matias Seniquiel
|
|
72
86
|
Michael Howitz
|
|
@@ -77,7 +91,9 @@ Paul Oswald
|
|
|
77
91
|
Pavel Tvrdík
|
|
78
92
|
Peter Carnesciali
|
|
79
93
|
Peter Karman
|
|
94
|
+
Peter McDonald
|
|
80
95
|
Petr Dlouhý
|
|
96
|
+
pySilver
|
|
81
97
|
Rodney Richardson
|
|
82
98
|
Rustem Saiargaliev
|
|
83
99
|
Rustem Saiargaliev
|
|
@@ -94,3 +110,6 @@ Víðir Valberg Guðmundsson
|
|
|
94
110
|
Will Beaufoy
|
|
95
111
|
pySilver
|
|
96
112
|
Łukasz Skarżyński
|
|
113
|
+
Wouter Klein Heerenbrink
|
|
114
|
+
Yaroslav Halchenko
|
|
115
|
+
Yuri Savin
|
{django-oauth-toolkit-2.3.0/django_oauth_toolkit.egg-info → django_oauth_toolkit-2.4.0}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: django-oauth-toolkit
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.4.0
|
|
4
4
|
Summary: OAuth2 Provider for Django
|
|
5
5
|
Home-page: https://github.com/jazzband/django-oauth-toolkit
|
|
6
6
|
Author: Federico Frenguelli, Massimiliano Pippi
|
|
@@ -9,24 +9,30 @@ Keywords: django,oauth,oauth2,oauthlib
|
|
|
9
9
|
Classifier: Development Status :: 5 - Production/Stable
|
|
10
10
|
Classifier: Environment :: Web Environment
|
|
11
11
|
Classifier: Framework :: Django
|
|
12
|
-
Classifier: Framework :: Django :: 2.2
|
|
13
12
|
Classifier: Framework :: Django :: 3.2
|
|
14
13
|
Classifier: Framework :: Django :: 4.0
|
|
15
14
|
Classifier: Framework :: Django :: 4.1
|
|
16
15
|
Classifier: Framework :: Django :: 4.2
|
|
16
|
+
Classifier: Framework :: Django :: 5.0
|
|
17
17
|
Classifier: Intended Audience :: Developers
|
|
18
18
|
Classifier: License :: OSI Approved :: BSD License
|
|
19
19
|
Classifier: Operating System :: OS Independent
|
|
20
20
|
Classifier: Programming Language :: Python :: 3
|
|
21
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
22
21
|
Classifier: Programming Language :: Python :: 3.8
|
|
23
22
|
Classifier: Programming Language :: Python :: 3.9
|
|
24
23
|
Classifier: Programming Language :: Python :: 3.10
|
|
25
24
|
Classifier: Programming Language :: Python :: 3.11
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
26
26
|
Classifier: Topic :: Internet :: WWW/HTTP
|
|
27
|
+
Requires-Python: >=3.8
|
|
27
28
|
Description-Content-Type: text/x-rst
|
|
28
29
|
License-File: LICENSE
|
|
29
30
|
License-File: AUTHORS
|
|
31
|
+
Requires-Dist: django!=4.0.0,>=3.2
|
|
32
|
+
Requires-Dist: requests>=2.13.0
|
|
33
|
+
Requires-Dist: oauthlib>=3.1.0
|
|
34
|
+
Requires-Dist: jwcrypto>=0.8.0
|
|
35
|
+
Requires-Dist: pytz>=2024.1
|
|
30
36
|
|
|
31
37
|
Django OAuth Toolkit
|
|
32
38
|
====================
|
|
@@ -63,7 +69,7 @@ If you are facing one or more of the following:
|
|
|
63
69
|
Django OAuth Toolkit can help you providing out of the box all the endpoints, data and logic needed to add OAuth2
|
|
64
70
|
capabilities to your Django projects. Django OAuth Toolkit makes extensive use of the excellent
|
|
65
71
|
`OAuthLib <https://github.com/idan/oauthlib>`_, so that everything is
|
|
66
|
-
`rfc-compliant <
|
|
72
|
+
`rfc-compliant <https://rfc-editor.org/rfc/rfc6749.html>`_.
|
|
67
73
|
|
|
68
74
|
Reporting security issues
|
|
69
75
|
-------------------------
|
|
@@ -73,8 +79,8 @@ Please report any security issues to the JazzBand security team at <security@jaz
|
|
|
73
79
|
Requirements
|
|
74
80
|
------------
|
|
75
81
|
|
|
76
|
-
* Python 3.
|
|
77
|
-
* Django
|
|
82
|
+
* Python 3.8+
|
|
83
|
+
* Django 3.2, 4.0 (4.0.1+ due to a regression), 4.1, 4.2, or 5.0
|
|
78
84
|
* oauthlib 3.1+
|
|
79
85
|
|
|
80
86
|
Installation
|
|
@@ -33,7 +33,7 @@ If you are facing one or more of the following:
|
|
|
33
33
|
Django OAuth Toolkit can help you providing out of the box all the endpoints, data and logic needed to add OAuth2
|
|
34
34
|
capabilities to your Django projects. Django OAuth Toolkit makes extensive use of the excellent
|
|
35
35
|
`OAuthLib <https://github.com/idan/oauthlib>`_, so that everything is
|
|
36
|
-
`rfc-compliant <
|
|
36
|
+
`rfc-compliant <https://rfc-editor.org/rfc/rfc6749.html>`_.
|
|
37
37
|
|
|
38
38
|
Reporting security issues
|
|
39
39
|
-------------------------
|
|
@@ -43,8 +43,8 @@ Please report any security issues to the JazzBand security team at <security@jaz
|
|
|
43
43
|
Requirements
|
|
44
44
|
------------
|
|
45
45
|
|
|
46
|
-
* Python 3.
|
|
47
|
-
* Django
|
|
46
|
+
* Python 3.8+
|
|
47
|
+
* Django 3.2, 4.0 (4.0.1+ due to a regression), 4.1, 4.2, or 5.0
|
|
48
48
|
* oauthlib 3.1+
|
|
49
49
|
|
|
50
50
|
Installation
|
{django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0/django_oauth_toolkit.egg-info}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: django-oauth-toolkit
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.4.0
|
|
4
4
|
Summary: OAuth2 Provider for Django
|
|
5
5
|
Home-page: https://github.com/jazzband/django-oauth-toolkit
|
|
6
6
|
Author: Federico Frenguelli, Massimiliano Pippi
|
|
@@ -9,24 +9,30 @@ Keywords: django,oauth,oauth2,oauthlib
|
|
|
9
9
|
Classifier: Development Status :: 5 - Production/Stable
|
|
10
10
|
Classifier: Environment :: Web Environment
|
|
11
11
|
Classifier: Framework :: Django
|
|
12
|
-
Classifier: Framework :: Django :: 2.2
|
|
13
12
|
Classifier: Framework :: Django :: 3.2
|
|
14
13
|
Classifier: Framework :: Django :: 4.0
|
|
15
14
|
Classifier: Framework :: Django :: 4.1
|
|
16
15
|
Classifier: Framework :: Django :: 4.2
|
|
16
|
+
Classifier: Framework :: Django :: 5.0
|
|
17
17
|
Classifier: Intended Audience :: Developers
|
|
18
18
|
Classifier: License :: OSI Approved :: BSD License
|
|
19
19
|
Classifier: Operating System :: OS Independent
|
|
20
20
|
Classifier: Programming Language :: Python :: 3
|
|
21
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
22
21
|
Classifier: Programming Language :: Python :: 3.8
|
|
23
22
|
Classifier: Programming Language :: Python :: 3.9
|
|
24
23
|
Classifier: Programming Language :: Python :: 3.10
|
|
25
24
|
Classifier: Programming Language :: Python :: 3.11
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
26
26
|
Classifier: Topic :: Internet :: WWW/HTTP
|
|
27
|
+
Requires-Python: >=3.8
|
|
27
28
|
Description-Content-Type: text/x-rst
|
|
28
29
|
License-File: LICENSE
|
|
29
30
|
License-File: AUTHORS
|
|
31
|
+
Requires-Dist: django!=4.0.0,>=3.2
|
|
32
|
+
Requires-Dist: requests>=2.13.0
|
|
33
|
+
Requires-Dist: oauthlib>=3.1.0
|
|
34
|
+
Requires-Dist: jwcrypto>=0.8.0
|
|
35
|
+
Requires-Dist: pytz>=2024.1
|
|
30
36
|
|
|
31
37
|
Django OAuth Toolkit
|
|
32
38
|
====================
|
|
@@ -63,7 +69,7 @@ If you are facing one or more of the following:
|
|
|
63
69
|
Django OAuth Toolkit can help you providing out of the box all the endpoints, data and logic needed to add OAuth2
|
|
64
70
|
capabilities to your Django projects. Django OAuth Toolkit makes extensive use of the excellent
|
|
65
71
|
`OAuthLib <https://github.com/idan/oauthlib>`_, so that everything is
|
|
66
|
-
`rfc-compliant <
|
|
72
|
+
`rfc-compliant <https://rfc-editor.org/rfc/rfc6749.html>`_.
|
|
67
73
|
|
|
68
74
|
Reporting security issues
|
|
69
75
|
-------------------------
|
|
@@ -73,8 +79,8 @@ Please report any security issues to the JazzBand security team at <security@jaz
|
|
|
73
79
|
Requirements
|
|
74
80
|
------------
|
|
75
81
|
|
|
76
|
-
* Python 3.
|
|
77
|
-
* Django
|
|
82
|
+
* Python 3.8+
|
|
83
|
+
* Django 3.2, 4.0 (4.0.1+ due to a regression), 4.1, 4.2, or 5.0
|
|
78
84
|
* oauthlib 3.1+
|
|
79
85
|
|
|
80
86
|
Installation
|
{django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/django_oauth_toolkit.egg-info/SOURCES.txt
RENAMED
|
@@ -29,6 +29,7 @@ oauth2_provider/scopes.py
|
|
|
29
29
|
oauth2_provider/settings.py
|
|
30
30
|
oauth2_provider/signals.py
|
|
31
31
|
oauth2_provider/urls.py
|
|
32
|
+
oauth2_provider/utils.py
|
|
32
33
|
oauth2_provider/validators.py
|
|
33
34
|
oauth2_provider/contrib/__init__.py
|
|
34
35
|
oauth2_provider/contrib/rest_framework/__init__.py
|
|
@@ -45,6 +46,9 @@ oauth2_provider/migrations/0004_auto_20200902_2022.py
|
|
|
45
46
|
oauth2_provider/migrations/0005_auto_20211222_2352.py
|
|
46
47
|
oauth2_provider/migrations/0006_alter_application_client_secret.py
|
|
47
48
|
oauth2_provider/migrations/0007_application_post_logout_redirect_uris.py
|
|
49
|
+
oauth2_provider/migrations/0008_alter_accesstoken_token.py
|
|
50
|
+
oauth2_provider/migrations/0009_add_hash_client_secret.py
|
|
51
|
+
oauth2_provider/migrations/0010_application_allowed_origins.py
|
|
48
52
|
oauth2_provider/migrations/__init__.py
|
|
49
53
|
oauth2_provider/templates/oauth2_provider/application_confirm_delete.html
|
|
50
54
|
oauth2_provider/templates/oauth2_provider/application_detail.html
|
|
@@ -85,6 +89,8 @@ tests/test_rest_framework.py
|
|
|
85
89
|
tests/test_scopes.py
|
|
86
90
|
tests/test_scopes_backend.py
|
|
87
91
|
tests/test_settings.py
|
|
92
|
+
tests/test_token_endpoint_cors.py
|
|
88
93
|
tests/test_token_revocation.py
|
|
89
94
|
tests/test_token_view.py
|
|
95
|
+
tests/test_utils.py
|
|
90
96
|
tests/test_validators.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "2.4.0"
|
|
@@ -107,7 +107,7 @@ class IsAuthenticatedOrTokenHasScope(BasePermission):
|
|
|
107
107
|
This only returns True if the user is authenticated, but not using a token
|
|
108
108
|
or using a token, and the token has the correct scope.
|
|
109
109
|
|
|
110
|
-
This is
|
|
110
|
+
This is useful when combined with the DjangoModelPermissions to allow people browse
|
|
111
111
|
the browsable api's if they log in using the a non token bassed middleware,
|
|
112
112
|
and let them access the api's using a rest client with a token
|
|
113
113
|
"""
|
|
@@ -17,7 +17,7 @@ class ClientIdGenerator(BaseHashGenerator):
|
|
|
17
17
|
def hash(self):
|
|
18
18
|
"""
|
|
19
19
|
Generate a client_id for Basic Authentication scheme without colon char
|
|
20
|
-
as in
|
|
20
|
+
as in https://rfc-editor.org/rfc/rfc2617.html#section-2
|
|
21
21
|
"""
|
|
22
22
|
return oauthlib_generate_client_id(length=40, chars=UNICODE_ASCII_CHARACTER_SET)
|
|
23
23
|
|
|
@@ -48,6 +48,13 @@ class Command(BaseCommand):
|
|
|
48
48
|
type=str,
|
|
49
49
|
help="The secret for this application",
|
|
50
50
|
)
|
|
51
|
+
parser.add_argument(
|
|
52
|
+
"--no-hash-client-secret",
|
|
53
|
+
dest="hash_client_secret",
|
|
54
|
+
action="store_false",
|
|
55
|
+
help="Don't hash the client secret",
|
|
56
|
+
)
|
|
57
|
+
parser.set_defaults(hash_client_secret=True)
|
|
51
58
|
parser.add_argument(
|
|
52
59
|
"--name",
|
|
53
60
|
type=str,
|
|
@@ -74,7 +81,7 @@ class Command(BaseCommand):
|
|
|
74
81
|
# Data in options must be cleaned because there are unneeded key-value like
|
|
75
82
|
# verbosity and others. Also do not pass any None to the Application
|
|
76
83
|
# instance so default values will be generated for those fields
|
|
77
|
-
if key in application_fields and value:
|
|
84
|
+
if key in application_fields and (isinstance(value, bool) or value):
|
|
78
85
|
if key == "user":
|
|
79
86
|
application_data.update({"user_id": value})
|
|
80
87
|
else:
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
|
|
1
3
|
from django.contrib.auth import authenticate
|
|
2
4
|
from django.utils.cache import patch_vary_headers
|
|
3
5
|
|
|
6
|
+
from oauth2_provider.models import get_access_token_model
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
log = logging.getLogger(__name__)
|
|
10
|
+
|
|
4
11
|
|
|
5
12
|
class OAuth2TokenMiddleware:
|
|
6
13
|
"""
|
|
@@ -36,3 +43,21 @@ class OAuth2TokenMiddleware:
|
|
|
36
43
|
response = self.get_response(request)
|
|
37
44
|
patch_vary_headers(response, ("Authorization",))
|
|
38
45
|
return response
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class OAuth2ExtraTokenMiddleware:
|
|
49
|
+
def __init__(self, get_response):
|
|
50
|
+
self.get_response = get_response
|
|
51
|
+
|
|
52
|
+
def __call__(self, request):
|
|
53
|
+
authheader = request.META.get("HTTP_AUTHORIZATION", "")
|
|
54
|
+
if authheader.startswith("Bearer"):
|
|
55
|
+
tokenstring = authheader.split()[1]
|
|
56
|
+
AccessToken = get_access_token_model()
|
|
57
|
+
try:
|
|
58
|
+
token = AccessToken.objects.get(token=tokenstring)
|
|
59
|
+
request.access_token = token
|
|
60
|
+
except AccessToken.DoesNotExist as e:
|
|
61
|
+
log.exception(e)
|
|
62
|
+
response = self.get_response(request)
|
|
63
|
+
return response
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
|
|
1
3
|
from django.db import migrations
|
|
2
|
-
|
|
4
|
+
|
|
3
5
|
import oauth2_provider.generators
|
|
4
6
|
import oauth2_provider.models
|
|
7
|
+
from oauth2_provider import settings
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
logger = logging.getLogger()
|
|
5
11
|
|
|
6
12
|
|
|
7
13
|
def forwards_func(apps, schema_editor):
|
|
@@ -14,6 +20,13 @@ def forwards_func(apps, schema_editor):
|
|
|
14
20
|
application.save(update_fields=['client_secret'])
|
|
15
21
|
|
|
16
22
|
|
|
23
|
+
def reverse_func(apps, schema_editor):
|
|
24
|
+
warning_color_code = "\033[93m"
|
|
25
|
+
end_color_code = "\033[0m"
|
|
26
|
+
msg = f"\n{warning_color_code}The previously hashed client_secret cannot be reverted, and it remains hashed{end_color_code}"
|
|
27
|
+
logger.warning(msg)
|
|
28
|
+
|
|
29
|
+
|
|
17
30
|
class Migration(migrations.Migration):
|
|
18
31
|
|
|
19
32
|
dependencies = [
|
|
@@ -26,5 +39,5 @@ class Migration(migrations.Migration):
|
|
|
26
39
|
name='client_secret',
|
|
27
40
|
field=oauth2_provider.models.ClientSecretField(blank=True, db_index=True, default=oauth2_provider.generators.generate_client_secret, help_text='Hashed on Save. Copy it now if this is a new secret.', max_length=255),
|
|
28
41
|
),
|
|
29
|
-
migrations.RunPython(forwards_func),
|
|
42
|
+
migrations.RunPython(forwards_func, reverse_func),
|
|
30
43
|
]
|
|
@@ -13,6 +13,6 @@ class Migration(migrations.Migration):
|
|
|
13
13
|
migrations.AddField(
|
|
14
14
|
model_name="application",
|
|
15
15
|
name="post_logout_redirect_uris",
|
|
16
|
-
field=models.TextField(blank=True, help_text="Allowed Post Logout URIs list, space separated"),
|
|
16
|
+
field=models.TextField(blank=True, help_text="Allowed Post Logout URIs list, space separated", default=""),
|
|
17
17
|
),
|
|
18
18
|
]
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Generated by Django 4.2.4 on 2023-09-11 07:03
|
|
2
|
+
|
|
3
|
+
from django.db import migrations, models
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Migration(migrations.Migration):
|
|
7
|
+
dependencies = [
|
|
8
|
+
("oauth2_provider", "0007_application_post_logout_redirect_uris"),
|
|
9
|
+
]
|
|
10
|
+
|
|
11
|
+
operations = [
|
|
12
|
+
migrations.AlterField(
|
|
13
|
+
model_name="accesstoken",
|
|
14
|
+
name="token",
|
|
15
|
+
field=models.CharField(db_index=True, max_length=255, unique=True),
|
|
16
|
+
),
|
|
17
|
+
]
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Generated by Django 4.2.5 on 2023-09-07 19:26
|
|
2
|
+
|
|
3
|
+
from django.db import migrations, models
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Migration(migrations.Migration):
|
|
7
|
+
|
|
8
|
+
dependencies = [
|
|
9
|
+
('oauth2_provider', '0008_alter_accesstoken_token'),
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
operations = [
|
|
13
|
+
migrations.AddField(
|
|
14
|
+
model_name='application',
|
|
15
|
+
name='hash_client_secret',
|
|
16
|
+
field=models.BooleanField(default=True),
|
|
17
|
+
),
|
|
18
|
+
]
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Generated by Django 4.1.5 on 2023-09-27 20:15
|
|
2
|
+
|
|
3
|
+
from django.db import migrations, models
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Migration(migrations.Migration):
|
|
7
|
+
|
|
8
|
+
dependencies = [
|
|
9
|
+
("oauth2_provider", "0009_add_hash_client_secret"),
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
operations = [
|
|
13
|
+
migrations.AddField(
|
|
14
|
+
model_name="application",
|
|
15
|
+
name="allowed_origins",
|
|
16
|
+
field=models.TextField(
|
|
17
|
+
blank=True,
|
|
18
|
+
help_text="Allowed origins list to enable CORS, space separated",
|
|
19
|
+
default="",
|
|
20
|
+
),
|
|
21
|
+
),
|
|
22
|
+
]
|
|
@@ -19,7 +19,8 @@ from oauthlib.oauth2.rfc6749 import errors
|
|
|
19
19
|
from .generators import generate_client_id, generate_client_secret
|
|
20
20
|
from .scopes import get_scopes_backend
|
|
21
21
|
from .settings import oauth2_settings
|
|
22
|
-
from .
|
|
22
|
+
from .utils import jwk_from_pem
|
|
23
|
+
from .validators import AllowedURIValidator
|
|
23
24
|
|
|
24
25
|
|
|
25
26
|
logger = logging.getLogger(__name__)
|
|
@@ -28,6 +29,10 @@ logger = logging.getLogger(__name__)
|
|
|
28
29
|
class ClientSecretField(models.CharField):
|
|
29
30
|
def pre_save(self, model_instance, add):
|
|
30
31
|
secret = getattr(model_instance, self.attname)
|
|
32
|
+
should_be_hashed = getattr(model_instance, "hash_client_secret", True)
|
|
33
|
+
if not should_be_hashed:
|
|
34
|
+
return super().pre_save(model_instance, add)
|
|
35
|
+
|
|
31
36
|
try:
|
|
32
37
|
hasher = identify_hasher(secret)
|
|
33
38
|
logger.debug(f"{model_instance}: {self.attname} is already hashed with {hasher}.")
|
|
@@ -109,6 +114,7 @@ class AbstractApplication(models.Model):
|
|
|
109
114
|
post_logout_redirect_uris = models.TextField(
|
|
110
115
|
blank=True,
|
|
111
116
|
help_text=_("Allowed Post Logout URIs list, space separated"),
|
|
117
|
+
default="",
|
|
112
118
|
)
|
|
113
119
|
client_type = models.CharField(max_length=32, choices=CLIENT_TYPES)
|
|
114
120
|
authorization_grant_type = models.CharField(max_length=32, choices=GRANT_TYPES)
|
|
@@ -119,12 +125,18 @@ class AbstractApplication(models.Model):
|
|
|
119
125
|
db_index=True,
|
|
120
126
|
help_text=_("Hashed on Save. Copy it now if this is a new secret."),
|
|
121
127
|
)
|
|
128
|
+
hash_client_secret = models.BooleanField(default=True)
|
|
122
129
|
name = models.CharField(max_length=255, blank=True)
|
|
123
130
|
skip_authorization = models.BooleanField(default=False)
|
|
124
131
|
|
|
125
132
|
created = models.DateTimeField(auto_now_add=True)
|
|
126
133
|
updated = models.DateTimeField(auto_now=True)
|
|
127
134
|
algorithm = models.CharField(max_length=5, choices=ALGORITHM_TYPES, default=NO_ALGORITHM, blank=True)
|
|
135
|
+
allowed_origins = models.TextField(
|
|
136
|
+
blank=True,
|
|
137
|
+
help_text=_("Allowed origins list to enable CORS, space separated"),
|
|
138
|
+
default="",
|
|
139
|
+
)
|
|
128
140
|
|
|
129
141
|
class Meta:
|
|
130
142
|
abstract = True
|
|
@@ -165,6 +177,14 @@ class AbstractApplication(models.Model):
|
|
|
165
177
|
"""
|
|
166
178
|
return redirect_to_uri_allowed(uri, self.post_logout_redirect_uris.split())
|
|
167
179
|
|
|
180
|
+
def origin_allowed(self, origin):
|
|
181
|
+
"""
|
|
182
|
+
Checks if given origin is one of the items in :attr:`allowed_origins` string
|
|
183
|
+
|
|
184
|
+
:param origin: Origin to check
|
|
185
|
+
"""
|
|
186
|
+
return self.allowed_origins and is_origin_allowed(origin, self.allowed_origins.split())
|
|
187
|
+
|
|
168
188
|
def clean(self):
|
|
169
189
|
from django.core.exceptions import ValidationError
|
|
170
190
|
|
|
@@ -182,12 +202,11 @@ class AbstractApplication(models.Model):
|
|
|
182
202
|
allowed_schemes = set(s.lower() for s in self.get_allowed_schemes())
|
|
183
203
|
|
|
184
204
|
if redirect_uris:
|
|
185
|
-
validator =
|
|
205
|
+
validator = AllowedURIValidator(
|
|
206
|
+
allowed_schemes, name="redirect uri", allow_path=True, allow_query=True
|
|
207
|
+
)
|
|
186
208
|
for uri in redirect_uris:
|
|
187
209
|
validator(uri)
|
|
188
|
-
scheme = urlparse(uri).scheme
|
|
189
|
-
if scheme not in allowed_schemes:
|
|
190
|
-
raise ValidationError(_("Unauthorized redirect scheme: {scheme}").format(scheme=scheme))
|
|
191
210
|
|
|
192
211
|
elif self.authorization_grant_type in grant_types:
|
|
193
212
|
raise ValidationError(
|
|
@@ -195,6 +214,13 @@ class AbstractApplication(models.Model):
|
|
|
195
214
|
grant_type=self.authorization_grant_type
|
|
196
215
|
)
|
|
197
216
|
)
|
|
217
|
+
allowed_origins = self.allowed_origins.strip().split()
|
|
218
|
+
if allowed_origins:
|
|
219
|
+
# oauthlib allows only https scheme for CORS
|
|
220
|
+
validator = AllowedURIValidator(oauth2_settings.ALLOWED_SCHEMES, "allowed origin")
|
|
221
|
+
for uri in allowed_origins:
|
|
222
|
+
validator(uri)
|
|
223
|
+
|
|
198
224
|
if self.algorithm == AbstractApplication.RS256_ALGORITHM:
|
|
199
225
|
if not oauth2_settings.OIDC_RSA_PRIVATE_KEY:
|
|
200
226
|
raise ValidationError(_("You must set OIDC_RSA_PRIVATE_KEY to use RSA algorithm"))
|
|
@@ -234,7 +260,7 @@ class AbstractApplication(models.Model):
|
|
|
234
260
|
if self.algorithm == AbstractApplication.RS256_ALGORITHM:
|
|
235
261
|
if not oauth2_settings.OIDC_RSA_PRIVATE_KEY:
|
|
236
262
|
raise ImproperlyConfigured("You must set OIDC_RSA_PRIVATE_KEY to use RSA algorithm")
|
|
237
|
-
return
|
|
263
|
+
return jwk_from_pem(oauth2_settings.OIDC_RSA_PRIVATE_KEY)
|
|
238
264
|
elif self.algorithm == AbstractApplication.HS256_ALGORITHM:
|
|
239
265
|
return jwk.JWK(kty="oct", k=base64url_encode(self.client_secret))
|
|
240
266
|
raise ImproperlyConfigured("This application does not support signed tokens")
|
|
@@ -356,6 +382,7 @@ class AbstractAccessToken(models.Model):
|
|
|
356
382
|
token = models.CharField(
|
|
357
383
|
max_length=255,
|
|
358
384
|
unique=True,
|
|
385
|
+
db_index=True,
|
|
359
386
|
)
|
|
360
387
|
id_token = models.OneToOneField(
|
|
361
388
|
oauth2_settings.ID_TOKEN_MODEL,
|
|
@@ -769,3 +796,26 @@ def redirect_to_uri_allowed(uri, allowed_uris):
|
|
|
769
796
|
return True
|
|
770
797
|
|
|
771
798
|
return False
|
|
799
|
+
|
|
800
|
+
|
|
801
|
+
def is_origin_allowed(origin, allowed_origins):
|
|
802
|
+
"""
|
|
803
|
+
Checks if a given origin uri is allowed based on the provided allowed_origins configuration.
|
|
804
|
+
|
|
805
|
+
:param origin: Origin URI to check
|
|
806
|
+
:param allowed_origins: A list of Origin URIs that are allowed
|
|
807
|
+
"""
|
|
808
|
+
|
|
809
|
+
parsed_origin = urlparse(origin)
|
|
810
|
+
|
|
811
|
+
if parsed_origin.scheme not in oauth2_settings.ALLOWED_SCHEMES:
|
|
812
|
+
return False
|
|
813
|
+
|
|
814
|
+
for allowed_origin in allowed_origins:
|
|
815
|
+
parsed_allowed_origin = urlparse(allowed_origin)
|
|
816
|
+
if (
|
|
817
|
+
parsed_allowed_origin.scheme == parsed_origin.scheme
|
|
818
|
+
and parsed_allowed_origin.netloc == parsed_origin.netloc
|
|
819
|
+
):
|
|
820
|
+
return True
|
|
821
|
+
return False
|
{django-oauth-toolkit-2.3.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/oauth2_backends.py
RENAMED
|
@@ -75,6 +75,11 @@ class OAuthLibCore:
|
|
|
75
75
|
del headers["wsgi.errors"]
|
|
76
76
|
if "HTTP_AUTHORIZATION" in headers:
|
|
77
77
|
headers["Authorization"] = headers["HTTP_AUTHORIZATION"]
|
|
78
|
+
# Add Access-Control-Allow-Origin header to the token endpoint response for authentication code grant,
|
|
79
|
+
# if the origin is allowed by RequestValidator.is_origin_allowed.
|
|
80
|
+
# https://github.com/oauthlib/oauthlib/pull/791
|
|
81
|
+
if "HTTP_ORIGIN" in headers:
|
|
82
|
+
headers["Origin"] = headers["HTTP_ORIGIN"]
|
|
78
83
|
if request.is_secure():
|
|
79
84
|
headers["X_DJANGO_OAUTH_TOOLKIT_SECURE"] = "1"
|
|
80
85
|
elif "X_DJANGO_OAUTH_TOOLKIT_SECURE" in headers:
|