Debian Codegraph @

docs/idp/openid-connect/installation.rst

raw
1 Installation
2 ============
3
4 In order to use this functionality you need to install the
5 ``idp-oidc`` extra as follows::
6
7 pip install "django-allauth[idp-oidc]"
8
9 As the provider functionality is dependent on the regular allauth account
10 handling, you will need to follow the installation instructions related to
11 ``allauth.account`` first. On top of that, you will need to add the following to
12 your project setup.
13
14 In your ``settings.py``, include the OpenID Connect provider app::
15
16 INSTALLED_APPS = [
17 ...
18 "allauth.idp.oidc",
19 ...
20 ]
21
22 Next, create a private key using the following command::
23
24 openssl genpkey -algorithm RSA -out private_key.pem -pkeyopt rsa_keygen_bits:2048
25
26 Then, include that ``private_key.pem`` in your ``settings.py``::
27
28 IDP_OIDC_PRIVATE_KEY = """
29 -----BEGIN PRIVATE KEY-----
30 MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCiStSwvoSk61uf
31 cQvkGDmR6gsM2QjVgKxCTPtg3tMhMO7kXq3PPMEiWlF49JicjPWs5vkYcLAsWNVE
32 ...
33 rfnteLIERvzd4rLi9WjTahfKA2Mq3YNIe3Hw8IDrrczJgd/XkEaENGYXmmNCX22B
34 gtUcukumVPtrDhGK9i/PG3Q=
35 -----END PRIVATE KEY-----
36 """
37
38 Your project ``urls.py`` should include::
39
40 urlpatterns = [
41 ...
42 path("", include("allauth.idp.urls")),
43 ...
44 ]
45
46
47 Maintenance
48 -----------
49
50 Issued tokens are stored in the database. Expired ones are never handed out, but
51 they do remain as stale rows. To purge them, periodically run the
52 ``oidc_cleartokens`` management command::
53
54 python manage.py oidc_cleartokens