| 1 |
Configuration |
| 2 |
============= |
| 3 |
|
| 4 |
Available settings: |
| 5 |
|
| 6 |
``IDP_OIDC_ACCESS_TOKEN_EXPIRES_IN`` (default: 3600) |
| 7 |
The time (in seconds) after which access tokens expire. |
| 8 |
|
| 9 |
``IDP_OIDC_ACCESS_TOKEN_FORMAT`` (default: ``"opaque"``) |
| 10 |
The format of issued access tokens. This can be ``"opaque"`` for randomized |
| 11 |
strings, or, ``"jwt"`` for JWT based access tokens. |
| 12 |
|
| 13 |
``IDP_OIDC_ADAPTER`` (default: ``"allauth.idp.oidc.adapter.DefaultOIDCAdapter"``) |
| 14 |
Specifies the adapter class to use, allowing you to alter certain |
| 15 |
default behavior. |
| 16 |
|
| 17 |
``IDP_OIDC_AUTHORIZATION_CODE_EXPIRES_IN`` (default: 60) |
| 18 |
The time (in seconds) after which authorization codes expire. |
| 19 |
|
| 20 |
``IDP_OIDC_DCR_ENABLED`` (default: ``False``) |
| 21 |
Controls whether Dynamic Client Registration is enabled. When enabled, clients |
| 22 |
can register themselves by POSTing to the registration endpoint. |
| 23 |
|
| 24 |
``IDP_OIDC_DCR_REQUIRES_INITIAL_ACCESS_TOKEN`` (default: ``True``) |
| 25 |
When enabled, the DCR endpoint requires an initial access token in the |
| 26 |
``Authorization`` header (``Bearer <token>``). This limits registration to |
| 27 |
previously authorized parties. |
| 28 |
|
| 29 |
``IDP_OIDC_CIMD_CACHE_TIMEOUT`` (default: 3600) |
| 30 |
The time (in seconds) to cache fetched CIMD metadata before re-fetching. |
| 31 |
|
| 32 |
``IDP_OIDC_CIMD_ENABLED`` (default: ``False``) |
| 33 |
Controls whether Client ID Metadata Document support is enabled. When enabled, |
| 34 |
clients can use an HTTPS URL as their ``client_id``. |
| 35 |
|
| 36 |
``IDP_OIDC_DEVICE_CODE_EXPIRES_IN`` (default: 300) |
| 37 |
The time (in seconds) after which device codes expire. |
| 38 |
|
| 39 |
``IDP_OIDC_DEVICE_CODE_INTERVAL`` (default: 5) |
| 40 |
The time (in seconds) a client should wait between polling attempts when using |
| 41 |
the device authorization flow. |
| 42 |
|
| 43 |
``IDP_OIDC_ID_TOKEN_EXPIRES_IN`` (default: 300) |
| 44 |
The time (in seconds) after which ID tokens expire. |
| 45 |
|
| 46 |
``IDP_OIDC_USER_CODE_FORMAT`` (default: ``settings.ALLAUTH_USER_CODE_FORMAT``) |
| 47 |
Controls the format of the user code. |
| 48 |
|
| 49 |
``IDP_OIDC_PRIVATE_KEY`` (default: ``""``) |
| 50 |
A string containing the PEM-encoded private key used for signing ID tokens and |
| 51 |
JWT access tokens (and for serving ``.well-known/jwks.json``). This is the |
| 52 |
simplest way to configure a single signing key. For key rotation, use |
| 53 |
``IDP_OIDC_PRIVATE_KEYS`` instead. |
| 54 |
|
| 55 |
``IDP_OIDC_PRIVATE_KEYS`` (default: ``[]``) |
| 56 |
A list of private keys, used to support key rotation. Each entry is a |
| 57 |
dictionary describing a single key:: |
| 58 |
|
| 59 |
IDP_OIDC_PRIVATE_KEYS = [ |
| 60 |
{ |
| 61 |
"pem": "-----BEGIN PRIVATE KEY-----\n...", |
| 62 |
"not_before": "2026-01-01T00:00:00+00:00", |
| 63 |
"expires_at": "2026-04-01T00:00:00+00:00", |
| 64 |
"issued_at": "2025-12-01T00:00:00+00:00", |
| 65 |
}, |
| 66 |
... |
| 67 |
] |
| 68 |
|
| 69 |
The ``pem`` field (the PEM-encoded private key) is required. The |
| 70 |
``not_before``, ``expires_at`` and ``issued_at`` fields are optional and may |
| 71 |
be passed either as ISO 8601 strings or as ``datetime`` objects (naive |
| 72 |
datetimes are interpreted as UTC). |
| 73 |
|
| 74 |
A key is published in ``.well-known/jwks.json`` and trusted for verifying |
| 75 |
tokens from the moment it is configured until its ``expires_at`` is reached |
| 76 |
(``not_before`` does not affect this -- keys are pre-published so clients can |
| 77 |
pick them up ahead of time). New tokens are always signed with the most |
| 78 |
recently *issued* key (``issued_at``, falling back to ``not_before``) that has |
| 79 |
activated and not yet expired. |
| 80 |
|
| 81 |
To rotate, add the new key with a later ``issued_at`` than the incumbent; |
| 82 |
signing switches to it automatically. Set an ``expires_at`` on the previous |
| 83 |
key far enough in the future that every token it signed has expired (and the |
| 84 |
JWKS cache window has elapsed) before it is removed. Until then the old key |
| 85 |
remains verify-only. |
| 86 |
|
| 87 |
Any key configured via ``IDP_OIDC_PRIVATE_KEY`` is automatically included in |
| 88 |
this list (without ``issued_at``), so it is treated as the oldest key and any |
| 89 |
dated key in ``IDP_OIDC_PRIVATE_KEYS`` takes over signing. |
| 90 |
|
| 91 |
``IDP_OIDC_JWKS_CACHE_CONTROL`` (default: 3600) |
| 92 |
Controls the cache control max age (in seconds) of the ``.well-known/jwks.json`` |
| 93 |
response. The value is automatically clamped so that it never exceeds the time |
| 94 |
until the next key drops out of the key set (the soonest ``expires_at``), |
| 95 |
ensuring clients refetch before a key they may still rely on is removed. |
| 96 |
|
| 97 |
|
| 98 |
``IDP_OIDC_RATE_LIMITS`` (default: ``{...}``) |
| 99 |
Rate limit configuration, defaulting to:: |
| 100 |
|
| 101 |
{ |
| 102 |
"device_user_code": "5/m/ip", |
| 103 |
"client_registration": "3/m/ip", |
| 104 |
"cimd_fetch": "3/m/ip", |
| 105 |
"introspect_ip": "30/m/ip", |
| 106 |
"introspect_client": "60/m/key", |
| 107 |
} |
| 108 |
|
| 109 |
The introspection endpoint is throttled by two independent limits: |
| 110 |
``introspect_ip`` is enforced per source IP before client authentication, so |
| 111 |
that unauthenticated and failed-authentication requests are bounded too, while |
| 112 |
``introspect_client`` is enforced per authenticated client afterwards. |
| 113 |
|
| 114 |
``IDP_OIDC_AUTH_METHODS`` (default: ``["client_secret_basic", "client_secret_post", "none"]``) |
| 115 |
The authentication methods supported by the token, device authorization and |
| 116 |
revocation endpoints. Currently supported values are ``client_secret_basic``, |
| 117 |
``client_secret_post`` and ``none`` (public clients). |
| 118 |
|
| 119 |
``IDP_OIDC_INTROSPECTION_ENABLED`` (default: ``False``) |
| 120 |
Controls whether the token introspection endpoint is enabled. When enabled, |
| 121 |
clients can introspect tokens by POSTing to the token introspection endpoint. |
| 122 |
|
| 123 |
``IDP_OIDC_INTROSPECTION_AUTH_METHODS`` (default: ``["client_secret_basic", "client_secret_post"]``) |
| 124 |
The authentication methods supported by the introspection endpoint. Currently |
| 125 |
supported values are ``client_secret_basic``, ``client_secret_post`` and |
| 126 |
``none`` (public clients). |
| 127 |
|
| 128 |
``IDP_OIDC_INTROSPECTION_CROSS_CLIENT_ALLOWED`` (default: ``False``) |
| 129 |
Controls whether an authenticated client may introspect tokens issued to |
| 130 |
*other* clients. An introspection response exposes metadata such as ``sub``, |
| 131 |
``scope``, ``aud`` and ``client_id``, so by default (``False``) a caller may |
| 132 |
only introspect its own tokens; any other token yields ``{"active": false}``, |
| 133 |
indistinguishable from an unknown one (as RFC 7662 requires). Enable only if |
| 134 |
you intentionally rely on shared introspection; combine it with the adapter's |
| 135 |
``is_introspection_allowed`` to narrow cross-client access (e.g. to callers |
| 136 |
listed in the token's audience). |
| 137 |
|
| 138 |
``IDP_OIDC_REFRESH_TOKEN_EXPIRES_IN`` (default: ``None``) |
| 139 |
Set to a positive number of seconds to make refresh tokens expire. By |
| 140 |
default (``None``) refresh tokens do not expire. With |
| 141 |
``IDP_OIDC_ROTATE_REFRESH_TOKEN`` enabled, each rotation issues a fresh |
| 142 |
token carrying a new expiry, resulting in a sliding (inactivity) window. |
| 143 |
With rotation disabled, the refresh token -- and its original expiry -- is |
| 144 |
reused as is, so the value acts as an absolute lifetime. Refresh tokens |
| 145 |
issued before this setting was enabled are unaffected by it. Whenever a |
| 146 |
refresh token carries an expiry, its remaining lifetime is returned to the |
| 147 |
client as ``refresh_expires_in`` (seconds) in the token response. Expired |
| 148 |
tokens are rejected, but not automatically purged from the database. |
| 149 |
|
| 150 |
``IDP_OIDC_ROTATE_REFRESH_TOKEN`` (default: ``True``) |
| 151 |
When access tokens are refreshed the old refresh token can be kept |
| 152 |
(``False``) or replaced (``True``) with a new one (rotated). |
| 153 |
|
| 154 |
``IDP_OIDC_RP_INITIATED_LOGOUT_ASKS_FOR_OP_LOGOUT`` (default: ``True``) |
| 155 |
During the RP initiated logout, the OIDC specification recommends that the end |
| 156 |
user is asked whether or not to logout of the OP as well. When this setting is |
| 157 |
``True``, the end user is always asked. When ``False``, the user is only asked |
| 158 |
if needed according to the specification. |
| 159 |
|
| 160 |
``IDP_OIDC_USERINFO_ENDPOINT`` (default: ``None``) |
| 161 |
This setting can be used to point the ``userinfo_endpoint`` value as returned |
| 162 |
in the ".well-known/openid-configuration" to a custom URL. Setting this |
| 163 |
disables the built-in userinfo endpoint. |