django-oauth-toolkit 2.2.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.
Files changed (102) hide show
  1. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/AUTHORS +27 -0
  2. {django-oauth-toolkit-2.2.0/django_oauth_toolkit.egg-info → django_oauth_toolkit-2.4.0}/PKG-INFO +14 -11
  3. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/README.rst +3 -8
  4. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0/django_oauth_toolkit.egg-info}/PKG-INFO +14 -11
  5. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/django_oauth_toolkit.egg-info/SOURCES.txt +33 -1
  6. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/django_oauth_toolkit.egg-info/requires.txt +2 -1
  7. django_oauth_toolkit-2.4.0/oauth2_provider/__init__.py +1 -0
  8. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/contrib/rest_framework/permissions.py +1 -1
  9. django_oauth_toolkit-2.4.0/oauth2_provider/exceptions.py +65 -0
  10. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/forms.py +14 -0
  11. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/generators.py +1 -1
  12. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/management/commands/createapplication.py +14 -1
  13. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/middleware.py +25 -0
  14. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/migrations/0006_alter_application_client_secret.py +15 -2
  15. django_oauth_toolkit-2.4.0/oauth2_provider/migrations/0007_application_post_logout_redirect_uris.py +18 -0
  16. django_oauth_toolkit-2.4.0/oauth2_provider/migrations/0008_alter_accesstoken_token.py +17 -0
  17. django_oauth_toolkit-2.4.0/oauth2_provider/migrations/0009_add_hash_client_secret.py +18 -0
  18. django_oauth_toolkit-2.4.0/oauth2_provider/migrations/0010_application_allowed_origins.py +22 -0
  19. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/models.py +78 -7
  20. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/oauth2_backends.py +5 -0
  21. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/oauth2_validators.py +55 -17
  22. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/settings.py +10 -2
  23. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/templates/oauth2_provider/application_detail.html +15 -0
  24. django_oauth_toolkit-2.4.0/oauth2_provider/templates/oauth2_provider/logout_confirm.html +37 -0
  25. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/urls.py +6 -1
  26. django_oauth_toolkit-2.4.0/oauth2_provider/utils.py +34 -0
  27. django_oauth_toolkit-2.4.0/oauth2_provider/validators.py +111 -0
  28. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/views/__init__.py +1 -1
  29. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/views/application.py +6 -0
  30. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/views/base.py +29 -2
  31. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/views/generic.py +2 -5
  32. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/views/introspect.py +1 -1
  33. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/views/mixins.py +24 -1
  34. django_oauth_toolkit-2.4.0/oauth2_provider/views/oidc.py +491 -0
  35. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/views/token.py +1 -1
  36. django_oauth_toolkit-2.4.0/pyproject.toml +17 -0
  37. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/setup.cfg +7 -3
  38. django_oauth_toolkit-2.4.0/tests/test_application_views.py +133 -0
  39. django_oauth_toolkit-2.4.0/tests/test_auth_backends.py +212 -0
  40. django_oauth_toolkit-2.4.0/tests/test_authorization_code.py +1908 -0
  41. django_oauth_toolkit-2.4.0/tests/test_client_credential.py +190 -0
  42. django_oauth_toolkit-2.4.0/tests/test_commands.py +145 -0
  43. django_oauth_toolkit-2.4.0/tests/test_decorators.py +89 -0
  44. django_oauth_toolkit-2.4.0/tests/test_generator.py +30 -0
  45. django_oauth_toolkit-2.4.0/tests/test_hybrid.py +1436 -0
  46. django_oauth_toolkit-2.4.0/tests/test_implicit.py +466 -0
  47. django_oauth_toolkit-2.4.0/tests/test_introspection_auth.py +288 -0
  48. django_oauth_toolkit-2.4.0/tests/test_introspection_view.py +347 -0
  49. django_oauth_toolkit-2.4.0/tests/test_mixins.py +209 -0
  50. django_oauth_toolkit-2.4.0/tests/test_models.py +608 -0
  51. django_oauth_toolkit-2.4.0/tests/test_oauth2_backends.py +223 -0
  52. django_oauth_toolkit-2.4.0/tests/test_oauth2_validators.py +580 -0
  53. django_oauth_toolkit-2.4.0/tests/test_oidc_views.py +862 -0
  54. django_oauth_toolkit-2.4.0/tests/test_password.py +101 -0
  55. django_oauth_toolkit-2.4.0/tests/test_rest_framework.py +417 -0
  56. django_oauth_toolkit-2.4.0/tests/test_scopes.py +422 -0
  57. django_oauth_toolkit-2.4.0/tests/test_scopes_backend.py +11 -0
  58. django_oauth_toolkit-2.4.0/tests/test_settings.py +174 -0
  59. django_oauth_toolkit-2.4.0/tests/test_token_endpoint_cors.py +160 -0
  60. django_oauth_toolkit-2.4.0/tests/test_token_revocation.py +205 -0
  61. django_oauth_toolkit-2.4.0/tests/test_token_view.py +209 -0
  62. django_oauth_toolkit-2.4.0/tests/test_utils.py +27 -0
  63. django_oauth_toolkit-2.4.0/tests/test_validators.py +266 -0
  64. django-oauth-toolkit-2.2.0/oauth2_provider/__init__.py +0 -7
  65. django-oauth-toolkit-2.2.0/oauth2_provider/exceptions.py +0 -19
  66. django-oauth-toolkit-2.2.0/oauth2_provider/validators.py +0 -46
  67. django-oauth-toolkit-2.2.0/oauth2_provider/views/oidc.py +0 -123
  68. django-oauth-toolkit-2.2.0/pyproject.toml +0 -10
  69. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/LICENSE +0 -0
  70. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/MANIFEST.in +0 -0
  71. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/django_oauth_toolkit.egg-info/dependency_links.txt +0 -0
  72. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/django_oauth_toolkit.egg-info/not-zip-safe +0 -0
  73. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/django_oauth_toolkit.egg-info/top_level.txt +0 -0
  74. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/admin.py +0 -0
  75. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/apps.py +0 -0
  76. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/backends.py +0 -0
  77. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/compat.py +0 -0
  78. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/contrib/__init__.py +0 -0
  79. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/contrib/rest_framework/__init__.py +0 -0
  80. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/contrib/rest_framework/authentication.py +0 -0
  81. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/decorators.py +0 -0
  82. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/http.py +0 -0
  83. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/management/__init__.py +0 -0
  84. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/management/commands/__init__.py +0 -0
  85. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/management/commands/cleartokens.py +0 -0
  86. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/migrations/0001_initial.py +0 -0
  87. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/migrations/0002_auto_20190406_1805.py +0 -0
  88. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/migrations/0003_auto_20201211_1314.py +0 -0
  89. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/migrations/0004_auto_20200902_2022.py +0 -0
  90. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/migrations/0005_auto_20211222_2352.py +0 -0
  91. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/migrations/__init__.py +0 -0
  92. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/scopes.py +0 -0
  93. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/signals.py +0 -0
  94. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/templates/oauth2_provider/application_confirm_delete.html +0 -0
  95. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/templates/oauth2_provider/application_form.html +0 -0
  96. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/templates/oauth2_provider/application_list.html +0 -0
  97. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/templates/oauth2_provider/application_registration_form.html +0 -0
  98. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/templates/oauth2_provider/authorize.html +0 -0
  99. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/templates/oauth2_provider/authorized-token-delete.html +0 -0
  100. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/templates/oauth2_provider/authorized-tokens.html +0 -0
  101. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/oauth2_provider/templates/oauth2_provider/base.html +0 -0
  102. {django-oauth-toolkit-2.2.0 → django_oauth_toolkit-2.4.0}/setup.py +0 -0
@@ -9,24 +9,33 @@ Contributors
9
9
 
10
10
  Abhishek Patel
11
11
  Adam Johnson
12
+ Adam Zahradník
13
+ Adheeth P Praveen
12
14
  Alan Crosswell
15
+ Alan Rominger
13
16
  Alejandro Mantecon Guillen
14
17
  Aleksander Vaskevich
15
18
  Alessandro De Angelis
19
+ Alex Manning
16
20
  Alex Szabó
21
+ Aliaksei Kanstantsinau
17
22
  Allisson Azevedo
18
23
  Andrea Greco
19
24
  Andrej Zbín
20
25
  Andrew Chen Wang
26
+ Andrew Zickler
27
+ Antoine Laurent
21
28
  Anvesh Agarwal
22
29
  Aristóbulo Meneses
23
30
  Aryan Iyappan
31
+ Asaf Klibansky
24
32
  Ash Christopher
25
33
  Asif Saif Uddin
26
34
  Bart Merenda
27
35
  Bas van Oostveen
28
36
  Brian Helba
29
37
  Carl Schwan
38
+ Daniel Golding
30
39
  Daniel 'Vector' Kerr
31
40
  Darrel O'Pry
32
41
  Dave Burkholder
@@ -40,27 +49,39 @@ Dulmandakh Sukhbaatar
40
49
  Dylan Giesler
41
50
  Dylan Tack
42
51
  Eduardo Oliveira
52
+ Egor Poderiagin
43
53
  Emanuele Palazzetti
44
54
  Federico Dolce
55
+ Florian Demmer
45
56
  Frederico Vieira
57
+ Gaël Utard
58
+ Glauco Junior
46
59
  Hasan Ramezani
47
60
  Hiroki Kiyohara
48
61
  Hossein Shakiba
49
62
  Islam Kamel
63
+ Ivan Lukyanets
50
64
  Jadiel Teófilo
51
65
  Jens Timmerman
52
66
  Jerome Leclanche
53
67
  Jesse Gibbs
54
68
  Jim Graham
69
+ John Byrne
55
70
  Jonas Nygaard Pedersen
56
71
  Jonathan Steffan
57
72
  Jordi Sanchez
58
73
  Joseph Abrahams
74
+ Josh Thomas
59
75
  Jozef Knaperek
76
+ Julian Mundhahs
60
77
  Julien Palard
61
78
  Jun Zhou
62
79
  Kaleb Porter
63
80
  Kristian Rune Larsen
81
+ Lazaros Toumanidis
82
+ Ludwig Hähne
83
+ Łukasz Skarżyński
84
+ Marcus Sonestedt
64
85
  Matias Seniquiel
65
86
  Michael Howitz
66
87
  Owen Gong
@@ -70,7 +91,9 @@ Paul Oswald
70
91
  Pavel Tvrdík
71
92
  Peter Carnesciali
72
93
  Peter Karman
94
+ Peter McDonald
73
95
  Petr Dlouhý
96
+ pySilver
74
97
  Rodney Richardson
75
98
  Rustem Saiargaliev
76
99
  Rustem Saiargaliev
@@ -78,6 +101,7 @@ Sandro Rodrigues
78
101
  Shaheed Haque
79
102
  Shaun Stanworth
80
103
  Silvano Cerza
104
+ Sora Yanai
81
105
  Spencer Carroll
82
106
  Stéphane Raimbault
83
107
  Tom Evans
@@ -86,3 +110,6 @@ Víðir Valberg Guðmundsson
86
110
  Will Beaufoy
87
111
  pySilver
88
112
  Łukasz Skarżyński
113
+ Wouter Klein Heerenbrink
114
+ Yaroslav Halchenko
115
+ Yuri Savin
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: django-oauth-toolkit
3
- Version: 2.2.0
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,22 +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
15
+ Classifier: Framework :: Django :: 4.2
16
+ Classifier: Framework :: Django :: 5.0
16
17
  Classifier: Intended Audience :: Developers
17
18
  Classifier: License :: OSI Approved :: BSD License
18
19
  Classifier: Operating System :: OS Independent
19
20
  Classifier: Programming Language :: Python :: 3
20
- Classifier: Programming Language :: Python :: 3.7
21
21
  Classifier: Programming Language :: Python :: 3.8
22
22
  Classifier: Programming Language :: Python :: 3.9
23
23
  Classifier: Programming Language :: Python :: 3.10
24
+ Classifier: Programming Language :: Python :: 3.11
25
+ Classifier: Programming Language :: Python :: 3.12
24
26
  Classifier: Topic :: Internet :: WWW/HTTP
27
+ Requires-Python: >=3.8
25
28
  Description-Content-Type: text/x-rst
26
29
  License-File: LICENSE
27
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
28
36
 
29
37
  Django OAuth Toolkit
30
38
  ====================
@@ -61,12 +69,7 @@ If you are facing one or more of the following:
61
69
  Django OAuth Toolkit can help you providing out of the box all the endpoints, data and logic needed to add OAuth2
62
70
  capabilities to your Django projects. Django OAuth Toolkit makes extensive use of the excellent
63
71
  `OAuthLib <https://github.com/idan/oauthlib>`_, so that everything is
64
- `rfc-compliant <http://tools.ietf.org/html/rfc6749>`_.
65
-
66
- Note: If you have issues installing Django 4.0.0, it is because we only support
67
- Django 4.0.1+ due to a regression in Django 4.0.0. Besides 4.0.0, Django 2.2+ is supported.
68
- `Explanation <https://github.com/jazzband/django-oauth-toolkit/pull/1046#issuecomment-998015272>`_.
69
-
72
+ `rfc-compliant <https://rfc-editor.org/rfc/rfc6749.html>`_.
70
73
 
71
74
  Reporting security issues
72
75
  -------------------------
@@ -76,8 +79,8 @@ Please report any security issues to the JazzBand security team at <security@jaz
76
79
  Requirements
77
80
  ------------
78
81
 
79
- * Python 3.7+
80
- * Django 2.2, 3.2, or >=4.0.1
82
+ * Python 3.8+
83
+ * Django 3.2, 4.0 (4.0.1+ due to a regression), 4.1, 4.2, or 5.0
81
84
  * oauthlib 3.1+
82
85
 
83
86
  Installation
@@ -33,12 +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 <http://tools.ietf.org/html/rfc6749>`_.
37
-
38
- Note: If you have issues installing Django 4.0.0, it is because we only support
39
- Django 4.0.1+ due to a regression in Django 4.0.0. Besides 4.0.0, Django 2.2+ is supported.
40
- `Explanation <https://github.com/jazzband/django-oauth-toolkit/pull/1046#issuecomment-998015272>`_.
41
-
36
+ `rfc-compliant <https://rfc-editor.org/rfc/rfc6749.html>`_.
42
37
 
43
38
  Reporting security issues
44
39
  -------------------------
@@ -48,8 +43,8 @@ Please report any security issues to the JazzBand security team at <security@jaz
48
43
  Requirements
49
44
  ------------
50
45
 
51
- * Python 3.7+
52
- * Django 2.2, 3.2, or >=4.0.1
46
+ * Python 3.8+
47
+ * Django 3.2, 4.0 (4.0.1+ due to a regression), 4.1, 4.2, or 5.0
53
48
  * oauthlib 3.1+
54
49
 
55
50
  Installation
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: django-oauth-toolkit
3
- Version: 2.2.0
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,22 +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
15
+ Classifier: Framework :: Django :: 4.2
16
+ Classifier: Framework :: Django :: 5.0
16
17
  Classifier: Intended Audience :: Developers
17
18
  Classifier: License :: OSI Approved :: BSD License
18
19
  Classifier: Operating System :: OS Independent
19
20
  Classifier: Programming Language :: Python :: 3
20
- Classifier: Programming Language :: Python :: 3.7
21
21
  Classifier: Programming Language :: Python :: 3.8
22
22
  Classifier: Programming Language :: Python :: 3.9
23
23
  Classifier: Programming Language :: Python :: 3.10
24
+ Classifier: Programming Language :: Python :: 3.11
25
+ Classifier: Programming Language :: Python :: 3.12
24
26
  Classifier: Topic :: Internet :: WWW/HTTP
27
+ Requires-Python: >=3.8
25
28
  Description-Content-Type: text/x-rst
26
29
  License-File: LICENSE
27
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
28
36
 
29
37
  Django OAuth Toolkit
30
38
  ====================
@@ -61,12 +69,7 @@ If you are facing one or more of the following:
61
69
  Django OAuth Toolkit can help you providing out of the box all the endpoints, data and logic needed to add OAuth2
62
70
  capabilities to your Django projects. Django OAuth Toolkit makes extensive use of the excellent
63
71
  `OAuthLib <https://github.com/idan/oauthlib>`_, so that everything is
64
- `rfc-compliant <http://tools.ietf.org/html/rfc6749>`_.
65
-
66
- Note: If you have issues installing Django 4.0.0, it is because we only support
67
- Django 4.0.1+ due to a regression in Django 4.0.0. Besides 4.0.0, Django 2.2+ is supported.
68
- `Explanation <https://github.com/jazzband/django-oauth-toolkit/pull/1046#issuecomment-998015272>`_.
69
-
72
+ `rfc-compliant <https://rfc-editor.org/rfc/rfc6749.html>`_.
70
73
 
71
74
  Reporting security issues
72
75
  -------------------------
@@ -76,8 +79,8 @@ Please report any security issues to the JazzBand security team at <security@jaz
76
79
  Requirements
77
80
  ------------
78
81
 
79
- * Python 3.7+
80
- * Django 2.2, 3.2, or >=4.0.1
82
+ * Python 3.8+
83
+ * Django 3.2, 4.0 (4.0.1+ due to a regression), 4.1, 4.2, or 5.0
81
84
  * oauthlib 3.1+
82
85
 
83
86
  Installation
@@ -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
@@ -44,6 +45,10 @@ oauth2_provider/migrations/0003_auto_20201211_1314.py
44
45
  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
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
47
52
  oauth2_provider/migrations/__init__.py
48
53
  oauth2_provider/templates/oauth2_provider/application_confirm_delete.html
49
54
  oauth2_provider/templates/oauth2_provider/application_detail.html
@@ -54,6 +59,7 @@ oauth2_provider/templates/oauth2_provider/authorize.html
54
59
  oauth2_provider/templates/oauth2_provider/authorized-token-delete.html
55
60
  oauth2_provider/templates/oauth2_provider/authorized-tokens.html
56
61
  oauth2_provider/templates/oauth2_provider/base.html
62
+ oauth2_provider/templates/oauth2_provider/logout_confirm.html
57
63
  oauth2_provider/views/__init__.py
58
64
  oauth2_provider/views/application.py
59
65
  oauth2_provider/views/base.py
@@ -61,4 +67,30 @@ oauth2_provider/views/generic.py
61
67
  oauth2_provider/views/introspect.py
62
68
  oauth2_provider/views/mixins.py
63
69
  oauth2_provider/views/oidc.py
64
- oauth2_provider/views/token.py
70
+ oauth2_provider/views/token.py
71
+ tests/test_application_views.py
72
+ tests/test_auth_backends.py
73
+ tests/test_authorization_code.py
74
+ tests/test_client_credential.py
75
+ tests/test_commands.py
76
+ tests/test_decorators.py
77
+ tests/test_generator.py
78
+ tests/test_hybrid.py
79
+ tests/test_implicit.py
80
+ tests/test_introspection_auth.py
81
+ tests/test_introspection_view.py
82
+ tests/test_mixins.py
83
+ tests/test_models.py
84
+ tests/test_oauth2_backends.py
85
+ tests/test_oauth2_validators.py
86
+ tests/test_oidc_views.py
87
+ tests/test_password.py
88
+ tests/test_rest_framework.py
89
+ tests/test_scopes.py
90
+ tests/test_scopes_backend.py
91
+ tests/test_settings.py
92
+ tests/test_token_endpoint_cors.py
93
+ tests/test_token_revocation.py
94
+ tests/test_token_view.py
95
+ tests/test_utils.py
96
+ tests/test_validators.py
@@ -1,4 +1,5 @@
1
- django!=4.0.0,>=2.2
1
+ django!=4.0.0,>=3.2
2
2
  requests>=2.13.0
3
3
  oauthlib>=3.1.0
4
4
  jwcrypto>=0.8.0
5
+ pytz>=2024.1
@@ -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 usefull when combined with the DjangoModelPermissions to allow people browse
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
  """
@@ -0,0 +1,65 @@
1
+ class OAuthToolkitError(Exception):
2
+ """
3
+ Base class for exceptions
4
+ """
5
+
6
+ def __init__(self, error=None, redirect_uri=None, *args, **kwargs):
7
+ super().__init__(*args, **kwargs)
8
+ self.oauthlib_error = error
9
+
10
+ if redirect_uri:
11
+ self.oauthlib_error.redirect_uri = redirect_uri
12
+
13
+
14
+ class FatalClientError(OAuthToolkitError):
15
+ """
16
+ Class for critical errors
17
+ """
18
+
19
+ pass
20
+
21
+
22
+ class OIDCError(Exception):
23
+ """
24
+ General class to derive from for all OIDC related errors.
25
+ """
26
+
27
+ status_code = 400
28
+ error = None
29
+
30
+ def __init__(self, description=None):
31
+ if description is not None:
32
+ self.description = description
33
+
34
+ message = "({}) {}".format(self.error, self.description)
35
+ super().__init__(message)
36
+
37
+
38
+ class InvalidRequestFatalError(OIDCError):
39
+ """
40
+ For fatal errors. These are requests with invalid parameter values, missing parameters or otherwise
41
+ incorrect requests.
42
+ """
43
+
44
+ error = "invalid_request"
45
+
46
+
47
+ class ClientIdMissmatch(InvalidRequestFatalError):
48
+ description = "Mismatch between the Client ID of the ID Token and the Client ID that was provided."
49
+
50
+
51
+ class InvalidOIDCClientError(InvalidRequestFatalError):
52
+ description = "The client is unknown or no client has been included."
53
+
54
+
55
+ class InvalidOIDCRedirectURIError(InvalidRequestFatalError):
56
+ description = "Invalid post logout redirect URI."
57
+
58
+
59
+ class InvalidIDTokenError(InvalidRequestFatalError):
60
+ description = "The ID Token is expired, revoked, malformed, or otherwise invalid."
61
+
62
+
63
+ class LogoutDenied(OIDCError):
64
+ error = "logout_denied"
65
+ description = "Logout has been refused by the user."
@@ -12,3 +12,17 @@ class AllowForm(forms.Form):
12
12
  code_challenge = forms.CharField(required=False, widget=forms.HiddenInput())
13
13
  code_challenge_method = forms.CharField(required=False, widget=forms.HiddenInput())
14
14
  claims = forms.CharField(required=False, widget=forms.HiddenInput())
15
+
16
+
17
+ class ConfirmLogoutForm(forms.Form):
18
+ allow = forms.BooleanField(required=False)
19
+ id_token_hint = forms.CharField(required=False, widget=forms.HiddenInput())
20
+ logout_hint = forms.CharField(required=False, widget=forms.HiddenInput())
21
+ client_id = forms.CharField(required=False, widget=forms.HiddenInput())
22
+ post_logout_redirect_uri = forms.CharField(required=False, widget=forms.HiddenInput())
23
+ state = forms.CharField(required=False, widget=forms.HiddenInput())
24
+ ui_locales = forms.CharField(required=False, widget=forms.HiddenInput())
25
+
26
+ def __init__(self, *args, **kwargs):
27
+ self.request = kwargs.pop("request", None)
28
+ super(ConfirmLogoutForm, self).__init__(*args, **kwargs)
@@ -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 http://tools.ietf.org/html/rfc2617#section-2
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
 
@@ -37,11 +37,24 @@ class Command(BaseCommand):
37
37
  type=str,
38
38
  help="The redirect URIs, this must be a space separated string e.g 'URI1 URI2'",
39
39
  )
40
+ parser.add_argument(
41
+ "--post-logout-redirect-uris",
42
+ type=str,
43
+ help="The post logout redirect URIs, this must be a space separated string e.g 'URI1 URI2'",
44
+ default="",
45
+ )
40
46
  parser.add_argument(
41
47
  "--client-secret",
42
48
  type=str,
43
49
  help="The secret for this application",
44
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)
45
58
  parser.add_argument(
46
59
  "--name",
47
60
  type=str,
@@ -68,7 +81,7 @@ class Command(BaseCommand):
68
81
  # Data in options must be cleaned because there are unneeded key-value like
69
82
  # verbosity and others. Also do not pass any None to the Application
70
83
  # instance so default values will be generated for those fields
71
- if key in application_fields and value:
84
+ if key in application_fields and (isinstance(value, bool) or value):
72
85
  if key == "user":
73
86
  application_data.update({"user_id": value})
74
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
- from oauth2_provider import settings
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
  ]
@@ -0,0 +1,18 @@
1
+ # Generated by Django 4.1.5 on 2023-01-14 12:32
2
+
3
+ from django.db import migrations, models
4
+
5
+
6
+ class Migration(migrations.Migration):
7
+
8
+ dependencies = [
9
+ ("oauth2_provider", "0006_alter_application_client_secret"),
10
+ ]
11
+
12
+ operations = [
13
+ migrations.AddField(
14
+ model_name="application",
15
+ name="post_logout_redirect_uris",
16
+ field=models.TextField(blank=True, help_text="Allowed Post Logout URIs list, space separated", default=""),
17
+ ),
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
+ ]