|
1 | | -# django-oidc-op |
2 | | -A Django implementation of an **OIDC Provider** built top of [jwtconnect libraries](https://jwtconnect.io/). |
3 | | -If you are just going to build a standard OIDC Provider you only have to write the configuration file. |
4 | | - |
5 | | -This project is based on [Roland Hedberg's oidc-op](https://github.com/rohe/oidc-op). |
6 | | - |
7 | | -## Status |
8 | | -_Work in Progress_ |
9 | | - |
10 | | -Please wait for the first release tag before considering it ready to use. |
11 | | -Before adopting this project in a production use you should consider if the following endpoint should be enabled: |
12 | | - |
13 | | -- [Web Finger](https://openid.net/specs/openid-connect-discovery-1_0.html#IssuerDiscovery) |
14 | | -- [dynamic discovery](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfig) |
15 | | -- [dynamic client registration](https://openid.net/specs/openid-connect-registration-1_0.html) |
16 | | - |
17 | | -**TODO**: _document how to disable them and how to register RP via django admin backend._ |
18 | | - |
19 | | -#### Endpoints |
20 | | - |
21 | | -Available resources are: |
22 | | - |
23 | | -- webfinger |
24 | | - - /.well-known/webfinger [to be tested] |
25 | | - |
26 | | -- provider_info |
27 | | - - /.well-known/openid-configuration |
28 | | - |
29 | | -- registration |
30 | | - - /registration |
31 | | - |
32 | | -- authorization |
33 | | - - /authorization |
34 | | - - authentication, which type decide to support, default: login form. |
35 | | - |
36 | | -- token |
37 | | - - access/authorization token |
38 | | - |
39 | | -- refresh_token |
40 | | - |
41 | | -- userinfo |
42 | | - - /userinfo |
43 | | - |
44 | | -- end_session |
45 | | - - logout |
46 | | - |
47 | | - |
48 | | -## Run the example demo |
49 | | - |
50 | | -```` |
51 | | -git clone https://github.com/peppelinux/django-oidc-op.git |
52 | | -cd django-oidc-op |
53 | | -
|
54 | | -pip install -r requirements.txt |
55 | | -
|
56 | | -cd example |
57 | | -pip install -r requirements.txt |
58 | | -./manage.py migrate |
59 | | -./manage.py createsuperuser |
60 | | -./manage.py collectstatic |
61 | | -
|
62 | | -gunicorn example.wsgi -b0.0.0.0:8000 --keyfile=./data/oidc_op/certs/key.pem --certfile=./data/oidc_op/certs/cert.pem --reload |
63 | | -```` |
64 | | - |
65 | | -You can use [JWTConnect-Python-OidcRP](https://github.com/openid/JWTConnect-Python-OidcRP) as an example RP as follows: |
66 | | - |
67 | | -`RP_LOGFILE_NAME="./flrp.django.log" python3 -m flask_rp.wsgi ../django-oidc-op/example/data/oidc_rp/conf.django.yaml` |
68 | | - |
69 | | - |
70 | | -## Configure OIDC endpoint |
71 | | - |
72 | | -#### Django settings.py parameters |
73 | | - |
74 | | -`OIDC_OP_AUTHN_SALT_SIZE`: Salt size in byte, default: 4 (Integer). |
75 | | - |
76 | | -#### Signatures |
77 | | -These following files needed to be present in `data/oidc_op/private`. |
78 | | - |
79 | | -1. session.json (JWK symmetric); |
80 | | -2. cookie_sign_jwk.json (JWK symmetric); |
81 | | -3. cookie_enc_jwk.json (JWK symmetric), optional, see `conf.yaml`. |
82 | | - |
83 | | -To create them by hands comment out `'read_only': False'` in `conf.yaml`, |
84 | | -otherwise they will be created automatically on each run. |
85 | | - |
86 | | -A JWK creation example would be: |
87 | | -```` |
88 | | -jwkgen --kty SYM > data/oidc_op/private/cookie_enc_jwk.json |
89 | | -```` |
90 | | - |
91 | | -## General description |
92 | | - |
93 | | -The example included in this project enables dynamic registration of RPs (you can even disable it). |
94 | | -Using an example RP like [JWTConnect-Python-OidcRP](https://github.com/openid/JWTConnect-Python-OidcRP) |
95 | | -and configuring in `CLIENTS` section to use django-oidc-op (see `example/data/oidc_rp/conf.django.yaml`), |
96 | | -we'll see the following flow happens: |
97 | | - |
98 | | -1. /.well-known/openid-configuration |
99 | | - RP get the Provider configuration, what declared in the configuration at `op.server_info`; |
100 | | -2. /registration |
101 | | - RP registers in the Provider if `dynamic client registration` is enabled (default true) |
102 | | -3. /authorization |
103 | | - RP mades OIDC authorization |
104 | | -4. RP going to be redirected to login form page (see authn_methods.py) |
105 | | -5. user-agent posts form (user credentials) to `/verify/user_pass_django` |
106 | | -6. verify_user in django, on top of oidcendpoint_app.endpoint_context.authn_broker |
107 | | -7. RP request for an access token -> the response of the previous authentication is a HttpRedirect to op's /token resource |
108 | | -8. RP get the redirection to OP's USERINFO endpoint, using the access token got before |
109 | | - |
110 | | - |
111 | | -## UserInfo endpoint |
112 | | - |
113 | | -Claims to be released are configured in `op.server_info.user_info` (in `conf.yaml`). |
114 | | -All the attributes release and user authentication mechanism rely on classes implemented in `oidc_op.users.py`. |
115 | | - |
116 | | -Configuration Example: |
117 | | - |
118 | | -```` |
119 | | - userinfo: |
120 | | - class: oidc_op.users.UserInfo |
121 | | - kwargs: |
122 | | - # map claims to django user attributes here: |
123 | | - claims_map: |
124 | | - phone_number: telephone |
125 | | - family_name: last_name |
126 | | - given_name: first_name |
127 | | - email: email |
128 | | - verified_email: email |
129 | | -```` |
130 | | - |
131 | | -**TODO**: Do a RP configuration UI for custom claims release for every client. |
132 | | - |
133 | | - |
134 | | -## OIDC endpoint url prefix |
135 | | -Can be configured in `urls.py` and also in oidc_op `conf.yaml`. |
136 | | - |
137 | | -- /oidc/endpoint/<provider_name> |
138 | | - |
| 1 | +djangoioidc-op |
| 2 | +-------------- |
139 | 3 |
|
| 4 | +Moved permanently to: |
140 | 5 |
|
| 6 | +https://github.com/peppelinux/django-oidc-op |
0 commit comments