Skip to content

Commit 51cd2e4

Browse files
committed
Merge branch 'main' into callback-routes
2 parents 658cafc + 1f9bf3b commit 51cd2e4

9 files changed

+54
-140
lines changed

.readthedocs.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ version: 2
99
build:
1010
os: ubuntu-22.04
1111
tools:
12-
python: "3.11"
12+
python: "3.12"
1313
# You can also specify other tool versions:
1414
# nodejs: "19"
1515
# rust: "1.64"
@@ -26,5 +26,5 @@ sphinx:
2626
# Optionally declare the Python requirements required to build your docs
2727
python:
2828
install:
29-
- requirements: requirements-test.txt
30-
- requirements: requirements.txt
29+
- requirements: requirements/3.10/requirements-test.txt
30+
- requirements: requirements/3.10/requirements.txt

README.md

+20-11
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,18 @@
33

44
<p align="center">
55
<a href="https://django-pyoidc.readthedocs.io">
6-
<img src="https://readthedocs.org/projects/django-pyoidc/badge/?version=main" />
6+
<img src="https://readthedocs.org/projects/django-pyoidc/badge/?version=stable&style=plastic"/>
77
</a>
8-
</p>
8+
<a href="https://pypi.org/project/django-pyoidc/">
9+
<img src="https://img.shields.io/pypi/v/django_pyoidc.svg"/>
10+
</a>
11+
<a href="https://pypi.org/project/django-pyoidc/">
12+
<img src="https://img.shields.io/pypi/pyversions/django_pyoidc"/>
13+
</a>
14+
<a href="https://pypi.org/project/django-pyoidc/">
15+
<img src="[https://img.shields.io/pypi/pyversions/django_pyoidc](https://img.shields.io/pypi/frameworkversions/django/django_pyoidc)"/>
16+
</a>
17+
918

1019
This library allow *Single Sign On* (SSO) integration into Django through the [Open ID Connect (OIDC)]() protocol.
1120

@@ -19,13 +28,13 @@ If you are not satisfied with the default configuration, take a look at the cook
1928

2029
## Features
2130

22-
- Easy configuration through premade [`Provider`](https://django-pyoidc.readthedocs.io/en/latest/user.html#providers) classes.
31+
- Easy configuration through premade `Provider` classes (see the list [here](https://django-pyoidc.readthedocs.io/latest/reference.html#providers)
2332
- Authenticate users from multiple providers
2433
- Bearer authentication support for [django-rest-framework](https://www.django-rest-framework.org/) integration (**single provider**)
25-
- Easy integration with the [Django permission system](https://django-pyoidc.readthedocs.io/en/latest/how-to.html#use-the-django-permission-system-with-oidc)
34+
- Easy integration with the [Django permission system](https://django-pyoidc.readthedocs.io/latest/how-to.html#use-the-django-permission-system-with-oidc)
2635
- Highly customizable design that should suit most needs
2736
- Support back-channel logout
28-
- Support service accounts (accounts for machine-to-machine uses)
37+
- Support service accounts (accounts for machine-to-machine authentication)
2938
- Sane and secure defaults settings
3039

3140
## Roadmap
@@ -43,7 +52,7 @@ We were also heavily inspired by :
4352
* [`mozilla-django-oidc`](https://github.com/mozilla/mozilla-django-oidc) for it's login redirection URI management
4453
* [`django-auth-oidc`](https://gitlab.com/aiakos/django-auth-oidc) for it's hook system
4554

46-
If you want to understand why we decided to implement our own library, this is documented [here](https://django-pyoidc.readthedocs.io/en/latest/explanation.html#other-oidc-libraries).
55+
If you want to understand why we decided to implement our own library, this is documented [here](https://django-pyoidc.readthedocs.io/latest/explanation.html).
4756

4857
## Documentation
4958

@@ -76,13 +85,13 @@ MIDDLEWARE = [
7685
]
7786
```
7887

79-
Now is time to run a migrate operation, as we create a database table ([read why here](https://django-pyoidc.readthedocs.io/en/latest/explanation.html#cache-management)). Run in your project dir :
88+
Now is time to run a migrate operation, as we create a database table ([read why here](https://django-pyoidc.readthedocs.io/latest/explanation.html#about-caching)). Run in your project dir :
8089

8190
```
8291
./manage.py migrate
8392
```
8493

85-
We also need a cache ([read why here](https://django-pyoidc.readthedocs.io/en/latest/explanation.html#cache-management)), so let's configure a dumb one for development purposes. Add in your `settings.py` :
94+
We also need a cache ([read why here](https://django-pyoidc.readthedocs.io/latest/explanation.html#about-caching)), so let's configure a dumb one for development purposes. Add in your `settings.py` :
8695

8796
```python
8897
CACHES = {
@@ -93,7 +102,7 @@ CACHES = {
93102
}
94103
```
95104

96-
Now you can pick an identity provider from the [available providers](https://django-pyoidc.readthedocs.io/en/latest/user.html#providers). Providers class are a quick way to generate the library configuration and URLs. You can also configure the settings manually, but this is not recommended if you are not familiar with the OpendID Connect (OIDC) protocol.
105+
Now you can pick an identity provider from the [available providers](https://django-pyoidc.readthedocs.io/latest/reference.html#providers). Providers class are a quick way to generate the library configuration and URLs. You can also configure the settings manually, but this is not recommended if you are not familiar with the OpendID Connect (OIDC) protocol.
97106

98107
Add the following `DJANGO_PYOIDC` to your `settings.py` :
99108

@@ -135,11 +144,11 @@ urlpatterns = [
135144

136145
And you are ready to go !
137146

138-
If you struggle with those instructions, take a look at [the quickstart tutorial](https://django-pyoidc.readthedocs.io/en/latest/tutorial.html#requirements).
147+
If you struggle with those instructions, take a look at [the quickstart tutorial](https://django-pyoidc.readthedocs.io/latest/tutorial.html).
139148

140149
## Usage/Examples
141150

142-
We wrote an extensive collection of 'how-to' guides in the [documentation](https://django-pyoidc.readthedocs.io/en/latest/how-to.html).
151+
We wrote an extensive collection of 'how-to' guides in the [documentation](https://django-pyoidc.readthedocs.io/latest/index.html).
143152

144153
## Appendix
145154

docs/explanation.rst

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _expl_new_oidc:
2+
13
Why make a new OIDC library ?
24
=============================
35

@@ -16,7 +18,8 @@ Here are our criteria :
1618
`django-allauth <https://github.com/pennersr/django-allauth/>`_
1719
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1820

19-
**Todo**
21+
This library OIDC implementation is based on the python package ``oic`` which we believe should not
22+
be used for OIDC usages.
2023

2124
`django-auth-oidc <https://gitlab.com/aiakos/django-auth-oidc>`_
2225
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -302,6 +305,8 @@ Note: if your Django acts as an OIDC SSO server for other applications, receivin
302305
containing an iframe with front channel logouts links for all the client applications of your Django. In this library we consider the
303306
Django website to be only an OIDC client (not server) and we did not implement this cascading front channel logout specification.
304307

308+
.. _expl_cache:
309+
305310
About caching
306311
=============
307312

docs/how-to.rst

+3-5
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Here is how it looks if we extend the configuration made in :ref:`Configure the
5555
},
5656
5757
58-
See :ref:`Hook settings` for more information on the function path syntax.
58+
See :ref:`Hook settings <settings_hook>` for more information on the function path syntax.
5959
6060
You should now see a message on login/logout ! 🎉
6161
@@ -136,7 +136,7 @@ group named *admin*. If you are not familiar with the claims available in your t
136136
137137
To have this function called instead of the default one, you need to modify your settings so that :ref:`hook_get_user` points to the function that we just wrote.
138138
139-
The value of this setting should be : ``<my_app>.oidc:login_function`` (see :ref:`Hook settings` for more information on this syntax).
139+
The value of this setting should be : ``<my_app>.oidc:login_function`` (see :ref:`Hook settings <settings_hook>` for more information on this syntax).
140140
141141
If you configured your settings manually (without using the providers system), you can add the key directly.
142142
@@ -267,11 +267,9 @@ TODO: RedirectDemo now exists, where do I connect it?
267267
Use multiple identity providers
268268
===============================
269269
270-
**TODO**
271-
272270
This library natively supports multiples identity providers.
273271
274-
You already have to specify a provider name when you configure your settings (either automatically by using a provider, or :ref:`manually <Providers settings>`).
272+
You already have to specify a provider name when you configure your settings (either automatically by using a provider, or :ref:`manually <provider-class-setting>`).
275273
276274
In a multi-provider setup, the settings look like this :
277275

docs/reference.rst

+4-1
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,11 @@ Providers classes allows the final user to configure their project without havin
4242
Each provider implements the configuration logic and should be used using the :ref:`provider-class-setting` setting.
4343

4444
.. tip::
45+
Read :ref:`the tutorial <tuto_settings>` to learn how to use provider class !
4546

46-
All the named arguments of __init__() can be set by configuring a setting **with the same**.
47+
.. tip::
48+
49+
All the named arguments of __init__() can be set by configuring a setting **with the same name**.
4750

4851
Provider list
4952
^^^^^^^^^^^^^

docs/settings.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,9 @@ cache_django_backend
185185

186186
This setting configures the cache backend that is used to store OIDC sessions details. It should be
187187
the name of a cache defined in the ``CACHES` django settings.
188-
You can read more about *Cache Management* :ref:`here <Cache Management>`.
188+
You can read more about *Cache Management* :ref:`here <expl_cache>`.
189+
190+
.. _settings_hook:
189191
190192
Hook
191193
====

docs/tutorial.rst

+5-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ Configure a cache backend
113113
*************************
114114

115115
**You must have a cache backend** for this library to work ! The OIDC protocol is very statefull and we use Django cache system to store data.
116-
If you want to understand why, you can read the :ref:`Cache Management` page.
116+
If you want to understand why, you can read the :ref:`Cache management <expl_cache>` page.
117117

118118
For the sake of this tutorial, you can use this cache management snippet (it should be pasted in your ``settings.py``) :
119119

@@ -129,6 +129,8 @@ For the sake of this tutorial, you can use this cache management snippet (it sho
129129
.. warning::
130130
Do not use those settings in production ! Go read the `django documentation <https://docs.djangoproject.com/en/stable/topics/cache/#setting-up-the-cache>`_ for more details.
131131

132+
.. _tuto_settings:
133+
132134
Configure the library
133135
*********************
134136

@@ -216,6 +218,8 @@ This will create 4 views in your URL configuration. They all have a name that de
216218
217219
You should now be able to use the view names from this library to redirect the user to a login/logout page.
218220
221+
.. _drf_tuto:
222+
219223
Configuring django_rest_framework
220224
=================================
221225

pyproject.toml

+10-2
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,21 @@ classifiers=["Topic :: Utilities",
1111
"Intended Audience :: Developers",
1212
"Environment :: Web Environment",
1313
"Framework :: Django",
14-
"Development Status :: 3 - Alpha",
14+
"Framework :: Django :: 3.2",
15+
"Framework :: Django :: 4",
16+
"Framework :: Django :: 4.0",
17+
"Framework :: Django :: 4.1",
18+
"Framework :: Django :: 4.2",
19+
"Framework :: Django :: 5",
20+
"Framework :: Django :: 5.0",
21+
"Framework :: Django :: 5.1",
22+
"Development Status :: 5 - Production/Stable",
1523
"Programming Language :: Python :: 3 :: Only",
24+
"Programming Language :: Python :: 3.8",
1625
"Programming Language :: Python :: 3.9",
1726
"Programming Language :: Python :: 3.10",
1827
"Programming Language :: Python :: 3.11",
1928
"Programming Language :: Python :: 3.12",
20-
"Programming Language :: Python :: 3.13",
2129
"Topic :: Security"
2230
]
2331
description="Authenticate your users using OpenID Connect (OIDC)"

requirements.txt

-115
This file was deleted.

0 commit comments

Comments
 (0)