You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+38-34
Original file line number
Diff line number
Diff line change
@@ -13,19 +13,26 @@ It can be used to setup a Single Sign On using an identity provider (Keycloak, e
13
13
14
14
**Warning** : this library has not been audited. However, we are based on [pyoidc](https://github.com/CZ-NIC/pyoidc/) which we believe is a sane OIDC implementation.
15
15
16
+
We tried to make OpenID Connect (OIDC) configuration as easy and secure as possible. However
17
+
everything can be customized, and we tried to take into account every use case in the library design.
18
+
If you are not satisfied with the default configuration, take a look at the cookbook or the setting reference.
19
+
16
20
## Features
17
21
18
22
- Easy configuration through premade [`Provider`](https://django-pyoidc.readthedocs.io/en/latest/user.html#providers) classes.
19
-
- Multiple provider support
23
+
- Authenticate users from multiple providers
24
+
- Bearer authentication support for [django-rest-framework](https://www.django-rest-framework.org/) integration (**single provider**)
20
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)
21
26
- Highly customizable design that should suit most needs
22
-
- Back-channel Logout
27
+
- Support back-channel logout
28
+
- Support service accounts (accounts for machine-to-machine uses)
23
29
- Sane and secure defaults settings
24
30
25
31
## Roadmap
26
32
27
-
-`Bearer` authentication support for `django-rest-framework` integration
28
33
- Frontchannel logout
34
+
- Switch to django signal system login/logout hooks
35
+
- Allow for audience check without customizing `get_user` using a setting
29
36
30
37
## Acknowledgement
31
38
@@ -47,7 +54,7 @@ The documentation is graciously hosted at [readthedocs](https://django-pyoidc.re
47
54
First, install the python package :
48
55
49
56
```bash
50
-
pip install makina-django-doic
57
+
pip install django_pyoidc
51
58
```
52
59
53
60
Then add the library app to your django applications, after `django.contrib.sessions` and `django.contrib.auth` :
@@ -86,52 +93,49 @@ CACHES = {
86
93
}
87
94
```
88
95
89
-
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 for a givenv identity provider. You can also use [manual set] if you wish.
90
-
91
-
Create a file named `oidc.py` next to your settings file and initialize your provider there :
92
-
93
-
FIXME: Here config as settings only OR using custom provider
94
-
95
-
```python
96
-
from django_pyoidc.providers.keycloak import KeycloakProvider
97
-
98
-
my_oidc_provider = KeycloakProvider(
99
-
op_name="keycloak",
100
-
keycloak_base_uri="http://keycloak.local:8080/auth/", # we use the auth/ path prefix option on Keycloak
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.
111
97
112
-
You can then add to your django configuration the following line :
98
+
Add the following `DJANGO_PYOIDC` to your `settings.py` :
113
99
114
100
```python
115
-
from .oidc_providers import my_oidc_provider
116
-
101
+
# settings
117
102
DJANGO_PYOIDC= {
118
-
**my_oidc_provider.get_config(),
119
-
}
103
+
# This is the name that your identity provider will have within the library
If you struggle with those instructions, take a look at [the quickstart tutorial](https://django-pyoidc.readthedocs.io/en/latest/tutorial.html#getting-started).
138
+
If you struggle with those instructions, take a look at [the quickstart tutorial](https://django-pyoidc.readthedocs.io/en/latest/tutorial.html#requirements).
Copy file name to clipboardExpand all lines: docs/explanation.rst
+16-12
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,5 @@
1
-
Makina Django OIDC Explanations
2
-
===============================
3
-
4
-
Other OIDC libraries
5
-
--------------------
1
+
Why make a new OIDC library ?
2
+
=============================
6
3
7
4
We decided to role our own OIDC integration with Django, and that is not a small work. As such we first performed an analysis of the existing libraries, evaluating whether or not we should contribute to them or implement our own.
8
5
@@ -15,6 +12,12 @@ Here are our criteria :
15
12
* is it still maintained ?
16
13
* does it supports *Bearer* authentication (for ``django-rest-framework``).
@@ -85,10 +88,11 @@ This library is based on ``django-auth-oidc`` and adds some glue to allow more f
85
88
- Documentation (which needs to covers also the *server* part) is not easy to use for an *simple* oidc client integration
86
89
87
90
This Project Goals
88
-
-------------------
91
+
==================
89
92
90
-
This project aim to make OIDC client integration with Django easier while still being robust, exapandable and flexible.
93
+
This project aim to make OIDC client integration with Django easier while still being robust, expandable and flexible.
91
94
To reach this goal we wanted a project with:
95
+
92
96
- good documentations, based on use cases and helping users doing the right things in the quite complex OIDC world
93
97
- robust security components (handling the cryptography and security aspects of OIDC)
94
98
- more real world usage than the too simple 'handle OIDC login' examples (like API modes, logouts, asynchronous logouts, MtoM mode, multi-tenant setup, etc.)
@@ -97,7 +101,7 @@ Handling the 'login' part in OIDC is quite easy, on the client side. And this pa
97
101
98
102
Direct Logout and Asynchronous logouts are more complex to understand and manage. The next section is a deeper explanation on this subject.
99
103
100
-
MtoM mode is about Machine-To-Machine communication, like B-to-B, the fact that you application may need to use OIDC not only to handle real
104
+
MtoM mode is about Machine-To-Machine communication, like B-to-B, the fact that your application may need to use OIDC not only to handle real
101
105
(human) users sessions, but also maybe connections made by some other applications, or you may also need to perform such operation (connecting
102
106
a remote web service using OIDC, not using an human account but a service account instead, identifying as an application and not as a human).
103
107
@@ -298,8 +302,8 @@ Note: if your Django acts as an OIDC SSO server for other applications, receivin
298
302
containing an iframe with front channel logouts links for all the client applications of your Django. In this library we consider the
299
303
Django website to be only an OIDC client (not server) and we did not implement this cascading front channel logout specification.
300
304
301
-
Cache Management
302
-
----------------
305
+
About caching
306
+
=============
303
307
304
308
This library depends on **Django cache system**. Why do an OIDC client depends on a cache ?
305
309
@@ -321,4 +325,4 @@ This data is stored in a database table.
321
325
:alt:Illustration of how a user session is killed in a backchannel logout request
322
326
323
327
.. image:: images/cache/oidc_bl_2.png
324
-
:alt:Illustration of how a user session is killed in a backchannel logout request
328
+
:alt:Illustration of how a user session is killed in a backchannel logout request
0 commit comments