Skip to content

Commit 2bd7dba

Browse files
Merge branch 'jazzband:master' into cors-oauthlib
2 parents 6f0a131 + f730b64 commit 2bd7dba

38 files changed

+1341
-81
lines changed

.github/workflows/test.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
13-
django-version: ['2.2', '3.2', '4.0', '4.1', 'main']
13+
django-version: ['2.2', '3.2', '4.0', '4.1', '4.2', 'main']
1414
exclude:
1515
# https://docs.djangoproject.com/en/dev/faq/install/#what-python-version-can-i-use-with-django
1616

@@ -24,13 +24,21 @@ jobs:
2424
- python-version: '3.7'
2525
django-version: '4.1'
2626
- python-version: '3.7'
27+
django-version: '4.2'
28+
- python-version: '3.7'
29+
django-version: 'main'
30+
31+
# < Python 3.10 is not supported by Django 5.0+
32+
- python-version: '3.8'
33+
django-version: 'main'
34+
- python-version: '3.9'
2735
django-version: 'main'
2836

2937
steps:
30-
- uses: actions/checkout@v2
38+
- uses: actions/checkout@v3
3139

3240
- name: Set up Python ${{ matrix.python-version }}
33-
uses: actions/setup-python@v2
41+
uses: actions/setup-python@v4
3442
with:
3543
python-version: ${{ matrix.python-version }}
3644

@@ -41,7 +49,7 @@ jobs:
4149
echo "::set-output name=dir::$(pip cache dir)"
4250
4351
- name: Cache
44-
uses: actions/cache@v2
52+
uses: actions/cache@v3
4553
with:
4654
path: ${{ steps.pip-cache.outputs.dir }}
4755
key:
@@ -61,7 +69,7 @@ jobs:
6169
DJANGO: ${{ matrix.django-version }}
6270

6371
- name: Upload coverage
64-
uses: codecov/codecov-action@v1
72+
uses: codecov/codecov-action@v3
6573
with:
6674
name: Python ${{ matrix.python-version }}
6775

@@ -71,4 +79,4 @@ jobs:
7179
name: Test successful
7280
steps:
7381
- name: Success
74-
run: echo Test successful
82+
run: echo Test successful

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/psf/black
3-
rev: 23.1.0
3+
rev: 23.3.0
44
hooks:
55
- id: black
66
exclude: ^(oauth2_provider/migrations/|tests/migrations/)

AUTHORS

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Contributors
99

1010
Abhishek Patel
1111
Adam Johnson
12+
Adheeth P Praveen
1213
Alan Crosswell
1314
Alejandro Mantecon Guillen
1415
Aleksander Vaskevich
@@ -19,6 +20,7 @@ Allisson Azevedo
1920
Andrea Greco
2021
Andrej Zbín
2122
Andrew Chen Wang
23+
Antoine Laurent
2224
Anvesh Agarwal
2325
Aristóbulo Meneses
2426
Aryan Iyappan
@@ -28,6 +30,7 @@ Bart Merenda
2830
Bas van Oostveen
2931
Brian Helba
3032
Carl Schwan
33+
Daniel Golding
3134
Daniel 'Vector' Kerr
3235
Darrel O'Pry
3336
Dave Burkholder
@@ -41,6 +44,7 @@ Dulmandakh Sukhbaatar
4144
Dylan Giesler
4245
Dylan Tack
4346
Eduardo Oliveira
47+
Egor Poderiagin
4448
Emanuele Palazzetti
4549
Federico Dolce
4650
Frederico Vieira
@@ -59,12 +63,13 @@ Jordi Sanchez
5963
Joseph Abrahams
6064
Josh Thomas
6165
Jozef Knaperek
62-
Julien Palard
6366
Julian Mundhahs
67+
Julien Palard
6468
Jun Zhou
6569
Kaleb Porter
6670
Kristian Rune Larsen
6771
Ludwig Hähne
72+
Marcus Sonestedt
6873
Matias Seniquiel
6974
Michael Howitz
7075
Owen Gong
@@ -91,4 +96,3 @@ Víðir Valberg Guðmundsson
9196
Will Beaufoy
9297
pySilver
9398
Łukasz Skarżyński
94-
Marcus Sonestedt

CHANGELOG.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1717
## [unreleased]
1818

1919
### Added
20-
* Add Japanese(日本語) Language Support
20+
* #1273 Add caching of loading of OIDC private key.
21+
* #1285 Add post_logout_redirect_uris field in application views.
2122

22-
### Changed
23-
* #1211 documentation improve on 'AUTHORIZATION_CODE_EXPIRE_SECONDS'.
24-
* #1218 Confim support for Python 3.11.
25-
* #1222 Remove expired ID tokens alongside access tokens in `cleartokens` management command
23+
- ### Fixed
24+
* #1284 Allow to logout whith no id_token_hint even if the browser session already expired
2625

27-
## [2.2.0] 2022-10-18
26+
## [2.3.0] 2023-05-31
2827

2928
### WARNING
3029

@@ -37,6 +36,17 @@ These issues both result in `{"error": "invalid_client"}`:
3736

3837
2. `PKCE_REQUIRED` is now `True` by default. You should use PKCE with your client or set `PKCE_REQUIRED=False` if you are unable to fix the client.
3938

39+
### Added
40+
* Add Japanese(日本語) Language Support
41+
* #1244 implement [OIDC RP-Initiated Logout](https://openid.net/specs/openid-connect-rpinitiated-1_0.html)
42+
* #1092 Allow Authorization Code flow without a client_secret per [RFC 6749 2.3.1](https://www.rfc-editor.org/rfc/rfc6749.html#section-2.3.1)
43+
44+
### Changed
45+
* #1222 Remove expired ID tokens alongside access tokens in `cleartokens` management command
46+
* #1267, #1253, #1251, #1250, #1224, #1212, #1211 Various documentation improvements
47+
48+
## [2.2.0] 2022-10-18
49+
4050
### Added
4151
* #1208 Add 'code_challenge_method' parameter to authorization call in documentation
4252
* #1182 Add 'code_verifier' parameter to token requests in documentation

README.rst

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,6 @@ capabilities to your Django projects. Django OAuth Toolkit makes extensive use o
3535
`OAuthLib <https://github.com/idan/oauthlib>`_, so that everything is
3636
`rfc-compliant <http://tools.ietf.org/html/rfc6749>`_.
3737

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-
42-
4338
Reporting security issues
4439
-------------------------
4540

@@ -49,7 +44,7 @@ Requirements
4944
------------
5045

5146
* Python 3.7+
52-
* Django 2.2, 3.2, or >=4.0.1
47+
* Django 2.2, 3.2, 4.0 (4.0.1+ due to a regression), 4.1, or 4.2
5348
* oauthlib 3.1+
5449

5550
Installation

docs/advanced_topics.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ logo, acceptance of some user agreement and so on.
2020
* :attr:`client_id` The client identifier issued to the client during the registration process as described in :rfc:`2.2`
2121
* :attr:`user` ref to a Django user
2222
* :attr:`redirect_uris` The list of allowed redirect uri. The string consists of valid URLs separated by space
23+
* :attr:`post_logout_redirect_uris` The list of allowed redirect uris after an RP initiated logout. The string consists of valid URLs separated by space
2324
* :attr:`client_type` Client type as described in :rfc:`2.1`
2425
* :attr:`authorization_grant_type` Authorization flows available to the Application
2526
* :attr:`client_secret` Confidential secret issued to the client during the registration process as described in :rfc:`2.2`

docs/management_commands.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ The ``createapplication`` management command provides a shortcut to create a new
3838
3939
usage: manage.py createapplication [-h] [--client-id CLIENT_ID] [--user USER]
4040
[--redirect-uris REDIRECT_URIS]
41+
[--post-logout-redirect-uris POST_LOGOUT_REDIRECT_URIS]
4142
[--client-secret CLIENT_SECRET]
4243
[--name NAME] [--skip-authorization]
4344
[--algorithm ALGORITHM] [--version]
@@ -64,6 +65,9 @@ The ``createapplication`` management command provides a shortcut to create a new
6465
--redirect-uris REDIRECT_URIS
6566
The redirect URIs, this must be a space separated
6667
string e.g 'URI1 URI2'
68+
--post-logout-redirect-uris POST_LOGOUT_REDIRECT_URIS
69+
The post logout redirect URIs, this must be a space
70+
separated string e.g 'URI1 URI2'
6771
--client-secret CLIENT_SECRET
6872
The secret for this application
6973
--name NAME The name this application

docs/oidc.rst

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ We support:
2323
* OpenID Connect Implicit Flow
2424
* OpenID Connect Hybrid Flow
2525

26+
Furthermore ``django-oauth-toolkit`` also supports `OpenID Connect RP-Initiated Logout <https://openid.net/specs/openid-connect-rpinitiated-1_0.html>`_.
27+
2628

2729
Configuration
2830
=============
@@ -147,6 +149,23 @@ scopes in your ``settings.py``::
147149
If you want to enable ``RS256`` at a later date, you can do so - just add
148150
the private key as described above.
149151

152+
153+
RP-Initiated Logout
154+
~~~~~~~~~~~~~~~~~~~
155+
This feature has to be enabled separately as it is an extension to the core standard.
156+
157+
.. code-block:: python
158+
159+
OAUTH2_PROVIDER = {
160+
# OIDC has to be enabled to use RP-Initiated Logout
161+
"OIDC_ENABLED": True,
162+
# Enable and configure RP-Initiated Logout
163+
"OIDC_RP_INITIATED_LOGOUT_ENABLED": True,
164+
"OIDC_RP_INITIATED_LOGOUT_ALWAYS_PROMPT": True,
165+
# ... any other settings you want
166+
}
167+
168+
150169
Setting up OIDC enabled clients
151170
===============================
152171

@@ -403,3 +422,10 @@ UserInfoView
403422

404423
Available at ``/o/userinfo/``, this view provides extra user details. You can
405424
customize the details included in the response as described above.
425+
426+
427+
RPInitiatedLogoutView
428+
~~~~~~~~~~~~~~~~~~~~~
429+
430+
Available at ``/o/rp-initiated-logout/``, this view allows a :term:`Client` (Relying Party) to request that a :term:`Resource Owner`
431+
is logged out at the :term:`Authorization Server` (OpenID Provider).

docs/settings.rst

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ this value if you wrote your own implementation (subclass of
4545
ACCESS_TOKEN_GENERATOR
4646
~~~~~~~~~~~~~~~~~~~~~~
4747
Import path of a callable used to generate access tokens.
48-
oauthlib.oauth2.tokens.random_token_generator is (normally) used if not provided.
48+
oauthlib.oauth2.rfc6749.tokens.random_token_generator is (normally) used if not provided.
4949

5050
ALLOWED_REDIRECT_URI_SCHEMES
5151
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -313,6 +313,41 @@ this you must also provide the service at that endpoint.
313313
If unset, the default location is used, eg if ``django-oauth-toolkit`` is
314314
mounted at ``/o/``, it will be ``<server-address>/o/userinfo/``.
315315

316+
OIDC_RP_INITIATED_LOGOUT_ENABLED
317+
~~~~~~~~~~~~~~~~~~~~~~~~
318+
Default: ``False``
319+
320+
When is set to `False` (default) the `OpenID Connect RP-Initiated Logout <https://openid.net/specs/openid-connect-rpinitiated-1_0.html>`_
321+
endpoint is not enabled. OpenID Connect RP-Initiated Logout enables an :term:`Client` (Relying Party)
322+
to request that a :term:`Resource Owner` (End User) is logged out at the :term:`Authorization Server` (OpenID Provider).
323+
324+
OIDC_RP_INITIATED_LOGOUT_ALWAYS_PROMPT
325+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
326+
Default: ``True``
327+
328+
Whether to always prompt the :term:`Resource Owner` (End User) to confirm a logout requested by a
329+
:term:`Client` (Relying Party). If it is disabled the :term:`Resource Owner` (End User) will only be prompted if required by the standard.
330+
331+
OIDC_RP_INITIATED_LOGOUT_STRICT_REDIRECT_URIS
332+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
333+
Default: ``False``
334+
335+
Enable this setting to require `https` in post logout redirect URIs. `http` is only allowed when a :term:`Client` is `confidential`.
336+
337+
OIDC_RP_INITIATED_LOGOUT_ACCEPT_EXPIRED_TOKENS
338+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
339+
Default: ``True``
340+
341+
Whether expired ID tokens are accepted for RP-Initiated Logout. The Tokens must still be signed by the OP and otherwise valid.
342+
343+
OIDC_RP_INITIATED_LOGOUT_DELETE_TOKENS
344+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
345+
Default: ``True``
346+
347+
Whether to delete the access, refresh and ID tokens of the user that is being logged out.
348+
The types of applications for which tokens are deleted can be customized with `RPInitiatedLogoutView.token_types_to_delete`.
349+
The default is to delete the tokens of all applications if this flag is enabled.
350+
316351
OIDC_ISS_ENDPOINT
317352
~~~~~~~~~~~~~~~~~
318353
Default: ``""``

docs/templates.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ This template gets passed the following template context variables:
165165
- ``client_type``
166166
- ``authorization_grant_type``
167167
- ``redirect_uris``
168+
- ``post_logout_redirect_uris``
168169

169170
.. caution::
170171
In the default implementation this template in extended by `application_registration_form.html`_.
@@ -184,6 +185,7 @@ This template gets passed the following template context variable:
184185
- ``client_type``
185186
- ``authorization_grant_type``
186187
- ``redirect_uris``
188+
- ``post_logout_redirect_uris``
187189

188190
.. note::
189191
In the default implementation this template extends `application_form.html`_.

0 commit comments

Comments
 (0)