Debian Codegraph @

doc/sources/admin/authopenidconnect.rst

raw
1 OpenID Connect
2 ==============
3
4 ============== ===== ========
5 Authentication Users Password
6 ============== ===== ========
7 ✔ ✔
8 ============== ===== ========
9
10 Presentation
11 ------------
12
13
14 .. note::
15
16 OpenID Connect is a protocol based on REST, OAuth 2.0 and JOSE
17 stacks. It is described here: http://openid.net/connect/.
18
19 LL::NG can act as an OpenID Connect Relying Party (RP) towards multiple
20 OpenID Connect Providers (OP). It will get the user identity through an
21 ID Token, and grab user attributes through UserInfo endpoint.
22
23 As an RP, LL::NG supports many OpenID Connect features:
24
25 - Authorization Code, Implicit and Hybrid flows
26 - Automatic download of JWKS
27 - JWT signature verification
28 - Encrypted JWT (JWE)
29 - Access Token Hash verification
30 - ID Token validation
31 - Get UserInfo as JSON or as JWT
32 - Logout on EndSession endpoint
33 - `Back Channel Logout <https://openid.net/specs/openid-connect-backchannel-1_0.html>`__
34 - `Front Channel Logout <https://openid.net/specs/openid-connect-frontchannel-1_0.html>`__
35 - `RP-Initiated Logout <https://openid.net/specs/openid-connect-rpinitiated-1_0.html>`__
36
37 You can use this authentication module to link your LL::NG server to any
38 OpenID Connect Provider. Here are some examples, with their specific
39 documentation:
40
41
42 .. toctree::
43 :hidden:
44
45 authopenidconnect_google
46 authopenidconnect_franceconnect
47 authopenidconnect_prosanteconnect
48
49
50 =============== ================== ================== ==================
51 Google France Connect Pro Santé Connect ProConnect
52 =============== ================== ================== ==================
53 |google| |franceconnect| |prosanteconnect| |proconnect|
54 =============== ================== ================== ==================
55
56 .. |google| image:: applications/google_logo.png
57 :target: authopenidconnect_google.html
58
59 .. |franceconnect| image:: applications/franceconnect_logo.png
60 :target: authopenidconnect_franceconnect.html
61
62 .. |prosanteconnect| image:: applications/prosanteconnect_logo.png
63 :target: authopenidconnect_prosanteconnect.html
64
65 .. |proconnect| image:: applications/proconnect.svg
66 :target: oidc-proconnect.html#ll-ng-as-relying-party
67
68 .. attention::
69
70 OpenID Connect specification is not achieved for logout propagation.
71 So logout initiated by relying-party will be forwarded to
72 OpenID Connect provider but logout initiated by the provider (or another
73 RP) will not be propagated. LL::NG will implement this when specification
74 is published.
75
76 Configuration
77 -------------
78
79 OpenID Connect Service
80 ~~~~~~~~~~~~~~~~~~~~~~
81
82 See :doc:`OpenID Connect service<openidconnectservice>` configuration
83 chapter.
84
85 Authentication and UserDB
86 ~~~~~~~~~~~~~~~~~~~~~~~~~
87
88 In ``General Parameters`` > ``Authentication modules``, set:
89
90 - **Authentication module**: OpenID Connect
91 - **Users module**: OpenID Connect
92
93
94 .. tip::
95
96 As passwords will not be managed by LL::NG, you can disable
97 :ref:`menu password module<portalmenu-menu-modules>`.
98
99
100 .. attention::
101
102 Browser implementations of formAction directive are
103 inconsistent (e.g. Firefox does not block the redirects whereas Chrome
104 does). Administrators may have to modify formAction value with wildcard
105 likes \*.
106
107 In Manager, go in:
108
109 ``General Parameters`` > ``Advanced Parameters`` > ``Security`` >
110 ``Content Security Policy`` > ``Form destination``
111
112 Then in ``General Parameters`` > ``Authentication modules`` >
113 ``OpenID Connect parameters``, you can set:
114
115 - **Authentication level**: authentication level associated to this module
116 - **Callback GET parameter**: name of the GET parameter used for intercepting
117 callback (default: openidconnectcallback)
118 - **State session timeout**: duration of a state session (used for keeping
119 state information between authentication request and authentication
120 response) in seconds (default: 600)
121
122 Register LL::NG to an OpenID Connect Provider
123 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
124
125 To register LL::NG, you will need to give some information like
126 application name or logo.
127
128 You will be prompted to provide a *Redirect URI* for LL::NG, which is built
129 by appending the ``openidconnectcallback=1`` parameter to the Portal URL.
130
131 For example:
132
133 - https://auth.example.com/?openidconnectcallback=1
134
135
136 .. attention::
137
138 If you use the :doc:`choice backend<authchoice>`,
139 you need to set SameSite cookie value to "Lax" or "None".
140 See :doc:`SSO cookie parameters<ssocookie>`
141
142 You may also be prompted for lougout type. LL::NG supports both *back* and
143 *front* channels. Its default logout urls are:
144
145 - https://<portal>/oauth2/flogout for the Front Channel
146 - https://<portal>/oauth2/blogout for the Back Channel
147
148 .. attention::
149
150 Front Channel use requires "iss" and "sid" parameters in requests (See
151 `frontchannel_logout_session_required <https://openid.net/specs/openid-connect-frontchannel-1_0.html#RPLogout>`__)
152
153 - https://<portal>/oauth2/rlogoutreturn should be allowed as a *post-logout* redirect URI
154
155 After registration, the OP must give you a *Client ID* and a *Client
156 secret* required to configure the OP in LL::NG.
157
158 Declare the OpenID Connect Provider in LL::NG
159 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
160
161 In Manager, select node ``OpenID Connect Providers`` and click on
162 ``Add OpenID Connect Provider``. Set a technical name (without space or
163 special character) like "sample-op".
164
165 You can then access to the configuration of this OP.
166
167 Metadata
168 ^^^^^^^^
169
170 The OP should publish its metadata in a JSON file (see for example
171 `Google
172 metadata <https://accounts.google.com/.well-known/openid-configuration>`__).
173 Copy the content of this file in the textarea.
174 Portal discovery document can be found here: \https://#portal#/.well-known/openid-configuration
175
176 If no metadata is available, you need to write them in the textarea.
177 Mandatory fields are:
178
179 - issuer
180 - authorization_endpoint
181 - token_endpoint
182 - userinfo_endpoint
183
184 You can also define:
185
186 - jwks_uri
187 - endsession_endpoint
188
189 Example template:
190
191 .. code-block:: javascript
192
193 {
194 "issuer": "https://auth.example.com/",
195 "authorization_endpoint": "https://auth.example.com/oauth2/authorize",
196 "token_endpoint": "https://auth.example.com/oauth2/token",
197 "userinfo_endpoint": "https://auth.example.com/oauth2/userinfo",
198 "end_session_endpoint":"https://auth.example.com/oauth2/logout"
199 }
200
201 JWKS data
202 ^^^^^^^^^
203
204 JWKS is a JSON file containing public keys. LL::NG can grab them
205 automatically if jwks_uri is defined in metadata. Else you can paste
206 the JSON file content in the textarea.
207
208
209 .. tip::
210
211 If the OpenID Connect provider only uses symmetric encryption,
212 JWKS data are useless.
213
214 Exported attributes
215 ^^^^^^^^^^^^^^^^^^^
216
217 Define here mapping between LL::NG session content and fields
218 provided in UserInfo endpoint response. These fields are defined in
219 `OpenID Connect standard <http://openid.net/specs/openid-connect-core-1_0.html#StandardClaims>`__,
220 and depends on the scope requested by LL::NG (see options below).
221
222 So you can define by example:
223
224 - cn => name
225 - sn => family_name
226 - mail => email
227 - uid => sub
228
229 Options
230 ^^^^^^^
231
232 Configuration
233 """""""""""""
234 - **PKCE required**: A code challenge is required at Tokens endpoint (see :rfc:`7636`)
235 - **Issuer required (RFC 9207)**: Require iss parameter in authorization response
236 to prevent mix-up attacks (see :rfc:`9207`). *Since 2.23.0*
237 - **Store ID token**: Allows one to store the ID Token (JWT) inside user session.
238 Do not enable it unless you need to replay this token on an application,
239 or if you need the id_token_hint parameter when using logout.
240 - **Configuration endpoint**: URL of OP configuration endpoint
241 - **JWKS data timeout**: After this time, LL::NG will do a request
242 to get a fresh version of JWKS data. Set to 0 to disable it
243 - **Client ID**: client ID given by OP
244 - **Client secret**: client secret given by OP
245 - **Attribute containing user identifier**: Set the value of the ID Token
246 claim that should be used as user main identifier. If empty, the ``sub``
247 claim is used.
248
249 Protocol
250 """"""""
251 - **Scope**: Value of scope parameter (example: openid profile). The
252 ``openid`` scope is mandatory.
253 - **Display**: Value of display parameter (example: page)
254 - **Prompt**: Value of prompt parameter (example: consent)
255 - **Max age**: Value of ``max_age`` parameter (example: 3600). A value of
256 ``0`` disables the ``max_age`` parameter. If you want to force
257 reauthentication, you can set **Prompt** to ``login`` or use a very short,
258 non-null value.
259 - **Locales UI**: Value of ui_locales parameter (example: en-GB en fr-FR fr)
260 - **ACR values**: Space-separated list of acceptable ACR values (example:
261 'loa-2 loa-3'). Authentication will fail if the OpenID Provider does not
262 supply one of the values listed here in the ID Token.
263 - **Extra parameters for authorization code request**: These additional
264 parameters will be added to the authorization request. URL-encoding is
265 automatically performed by LemonLDAP. This can be useful if you need to
266 specify a ``claims`` parameter.
267 - **Authentication method for authorization code request**: Require JWS authentication for code requests
268 - **Signature algorithm for authorization code authentication**: Fix signature algorithm to be used for JWS authentication for code requests
269 - **Token endpoint authentication method**: choice between
270 ``client_secret_post``, ``client_secret_basic``, ``client_secret_jwt`` and ``private_key_jwt``
271 - **Signature algorithm for token endpoint authentication**: select an
272 algorithm compatible with the authentication method: ``client_secret_jwt``
273 requires a ``HS*`` algorithm, ``private_key_jwt`` requires either ``RS*`` or
274 ``ES*`` depending on the type of your private key.
275 - **Signing key name**: Since ``2.22.0``, lets you use a
276 :doc:`different key <keys>` for signing requests.
277 - **Check JWT signature**: Set to 0 to disable JWT signature
278 checking
279 - **ID Token max age**: If defined, LL::NG will check the ID Token
280 date and reject it if too old
281 - **Use nonce**: If enabled, a nonce will be sent, and verified from
282 the ID Token
283 - **User Info source**: source of user data. Default to query userInfo endpoint
284 - **Don't insert typ header**: don't add the type header in JWT
285
286 Comment: Set a comment
287 """""""""""""""""""""""
288
289 Display
290 ^^^^^^^
291
292 Used only if at least 2 OIDC Providers are declared
293
294 - **Name**: Name of the OP
295 - **Logo**: Logo of the OP
296 - **Tooltip**: Information displayed on mouse over the button
297 - **Resolution rule**: Rule that will be applied to preselect an OP
298 for a user. You have access to all environment variables *(like user
299 IP address)* and all session keys. You have also access to OIDC parameters
300 constituting the QueryString. Those variables are prefixed by ``llng_oidc_``.
301
302 For example, to preselect this OP for users coming from 192.168.0.0/16 network ::
303
304 $ENV{REMOTE_ADDR} =~ /^192\.168/
305
306 $env->{REMOTE_ADDR} =~ /^192\.168/
307
308 inSubnet('192.168.0.0/16')
309
310 To preselect this OP when the ``MY_OP`` :doc:`choice <authchoice>` is selected ::
311
312 $_choice eq "MY_OP"
313
314 To preselect this OP for users with a particular ``login_hint`` ::
315
316 $env->{llng_oidc_login_hint} =~ /@example\.com$/
317
318
319 - **Order**: Used for sorting OP
320
321 .. attention::
322
323 With HTTPS authorization endpoint, you may have to set **LWP::UserAgent object**
324 with ``verify_hostname => 0`` and ``SSL_verify_mode => 0``.
325
326
327 Go to: ``General Parameters > Advanced Parameters > Security > SSL options for server requests``
328
329 Manual IDP Selection
330 --------------------
331
332 When using multiple OpenID Providers, LemonLDAP::NG will display an additional
333 choice screen to let the user decide which OP they want to use.
334
335 In addition to the *resolution rule* described above, you can also use the
336 ``idp`` URL parameter to automatically select an OP for the user: ``https://auth.example.com/?idp=op-example``