Skip to content

Commit 4905f39

Browse files
authored
Merge pull request mendix#6450 from mendix/MvM-OIDCSSO-20230831
OIDC SSO Release - 7 September 2023
2 parents 953a695 + 185c7c3 commit 4905f39

6 files changed

Lines changed: 222 additions & 22 deletions

File tree

content/en/docs/appstore/modules/oidc-provider.md

Lines changed: 58 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@ The OIDC Provider has the following features and limitations:
3737

3838
**Features**
3939

40-
* allows for registration of Mendix apps via the client registration endpoint
41-
* works/integrates with the platform-supported [OIDC SSO](/appstore/modules/oidc/) module
40+
* It allows for registration of Mendix apps via the client registration endpoint.
41+
* It works/integrates with the platform-supported [OIDC SSO](/appstore/modules/oidc/) module.
42+
* It provides a standard mechanism to communicate which user roles are assigned for the end-user in connected Mendix apps.
4243
* It supports responsive web applications, using the common OAuth Authorization Code grant.
4344
* Your apps can be registered as an OIDC client with the OIDC Provider using the client registration API or client configuration screen. The client registration API allows you to register your client automatically when using a CI/CD deployment pipeline.
4445
* It publishes a well-known endpoint to communicate endpoints and other IdP characteristics to client applications. Mendix apps using the OIDC SSO module will consume this endpoint to perform actions like retrieving the keys needed to validate ID-tokens that they receive.
@@ -201,7 +202,7 @@ Choose one of the two options, below.
201202

202203
Whichever option you choose, you will need to use [Custom User Provisioning](/appstore/modules/oidc/#custom-provisioning) in the OIDC SSO module of your client app to assign the correct user roles to the end-user.
203204

204-
##### 3.3.3.1 Configuration of the OIDC Provider for Centralized Authorization with Scopes
205+
##### 3.3.3.1 Configuration of the OIDC Provider for Centralized Authorization with Scopes{#configure-scopes}
205206

206207
When you follow the recommended approach for [centralized authorization](#centralized-auth) using OAuth scopes, the OIDC Provider needs to know which user roles have been implemented in your Mendix apps, so the client can assign those user roles.
207208

@@ -210,11 +211,17 @@ The scope values (user roles) that you assign to the authenticated user in the O
210211
To return requested scopes to your client app, you need to perform the following steps to configure the OIDC Provider:
211212

212213
1. Open the **Scopes** tab for the client you want to configure
213-
1. Create a new scope for every user role which is implemented in your client apps. This scope has the same **Name** as the user role in your client app.
214+
1. Create a new scope for every user role which is implemented in your client apps. You can identify the user role in one of two ways:
215+
216+
1. use the **Name** as the user role in your client app.
217+
1. From version 1.1.0 you can also use the UUID of the user role in your client app.
218+
219+
The benefit of this second approach is that it avoids ‘scope collision’. In other words, you avoid having confusion between user roles with the same name but in different apps.
214220

215221
If your client app consumes APIs and wants to get access using the Access Token from the OIDC Provider, you may want to configure additional scope values, as required by those APIs.
216222

217223
{{% alert color="warning" %}}
224+
218225
Do not to create scopes with the same name as standard scopes (as defined in the [OIDC specs](https://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims)), for example:
219226

220227
* openid - apps will use this scope value to request identity propagation from the OIDC Provider by means of an ID-token.
@@ -224,7 +231,7 @@ Do not to create scopes with the same name as standard scopes (as defined in the
224231
{{% /alert %}}
225232

226233
{{% alert color="info" %}}
227-
The scopes you configure are not added automatically to the scopes_supported attribute on the OIDC Provider’s well-known endpoint. You must manually configure the scope value in your client app to be able to request it.
234+
The scopes you configure are not added automatically to the "scopes_supported" attribute on the OIDC Provider’s well-known endpoint. You must manually configure the scope value in your client app to be able to request it.
228235
{{% /alert %}}
229236

230237
1. Add logic to the OIDC Provider to assign user roles (custom scope values) based on your preferred business logic.
@@ -240,13 +247,35 @@ The scopes you configure are not added automatically to the “scopes_supported
240247

241248
{{% alert color="info" %}}The default implementation of `OpenIDConnectProvider.SUB_CustomScope` grants any requested scope provided it is associated with client (your Mendix app). It does not do any validation of the end user.{{% /alert %}}
242249

250+
1. In the connected apps, select the following microflows in the [OIDC SSO](/appstore/modules/oidc/) module to let you app apply the assigned user roles to the end-users:
251+
252+
* `UserProvisioning_StandardOIDC` as the user provisioning microflow
253+
254+
This is available in version 2.3.0 and above of the OIDC SSO module. For versions below this, you will need to write a custom user provisioning microflow.
255+
256+
* `OIDC.Default_OIDCProvider_TokenProcessing_CustomATP` as the **custom AccessToken processing microflow** for access token parsing
257+
243258
##### 3.3.3.2 Configuration of the OIDC Provider to Propagate the End-User’s Identity with Custom Claims{#propagate-custom-claims}
244259

245260
Typically you want to propagate the end-user’s identity from the OIDC Provider to your Mendix app. Although the basic user attributes like ‘email address’ and ‘user name’ may be sufficient, your app may need more information about the end-user. User attributes like ‘department’ or ‘job-title’ may be used for business logic, including decentralized authorization.
246261

247262
To pass this additional information, you need to create custom claims. You can do this as follows:
248263

249264
1. Create a microflow which returns a value to the claim.
265+
266+
From version 1.1.0, you can also pass an object from the Domain Model as the custom claim in an ID-token. To do this, your microflow should return the object.
267+
268+
The ID-token will be a nested JSON structure with the name of the object as the key and a list of attribute names of your object as the keys and the attribute values as the values.
269+
270+
```json {linenos=false}
271+
"MyObjectName": {
272+
"MyObjectAttribute1Name" : "MyObjectAttribute1Value",
273+
"MyObjectAttribute2Name" : "MyObjectAttribute2Value"
274+
}
275+
```
276+
277+
"MyObjectName" will be used as the claim name. See note about how to name custom claims in the [Propagate Custom Claims](#propagate-custom-claims) section, above.
278+
250279
1. Run (publish) your app.
251280
1. Sign in to your app as an Administrator.
252281
1. Open the **Mx Objects** overview page and synchronize the required modules to see the new microflow.
@@ -342,26 +371,35 @@ The format of non-custom claims in the ID-token is as follows:
342371
```json {linenos=false}
343372
{
344373
"com.mendix.user.language": "en_US",
345-
"sub": "test",
374+
"sub": "3",
346375
"iss": "http://localhost:8080/",
347376
"com.mendix.user.entity": "Administration.Account",
348377
"nonce": "k5CDLkTE7Q61Q0cUTSgy",
349378
"com.mendix.user.attributes": {
350-
"Email": "",
351-
"FullName": "test",
379+
"Email": "janedoe@example.com",
380+
"FullName": "Jane Doe",
352381
"IsLocalUser": "true"
353382
},
354383
"aud": "DemoClient",
355384
"scope": "",
385+
"name": "Jane Doe",
356386
"exp": 1681970318,
387+
"email":"janedoe@example.com",
357388
"com.mendix.user.timezone": "",
358389
"iat": 1681969718,
359390
"com.mendix.user.roles": [
360391
"User"
361392
]
393+
"username":"Jane Doe"
362394
}
363395
```
364396

397+
In versions of OIDC Provider below 1.1.0, the following values are not included in the ID-token claim:
398+
399+
* "email"
400+
* "name"
401+
* "username"
402+
365403
## 6 Troubleshooting
366404

367405
### 6.1 Infinite Loop of Redirects
@@ -405,7 +443,7 @@ Using OAuth scopes is the recommended approach since it is the standard OAuth so
405443

406444
Since the OIDC Provider issues access tokens for end-users that are logged in, it needs to record end-users as objects in the app which contains the OIDC Provider module.
407445

408-
The OIDC Provider module adds the `AccountDetail` entity into your Provider app. It uses the `MendixUserID` attribute of `AccountDetail` to populate the sub claim in the access token. For any other user claims you want to include in your access token, you need to create a microflow as described in [Configuration of the OIDC Provider to Propagate the End-User’s Identity with Custom Claims](#propagate-custom-claims), above.
446+
The OIDC Provider module adds the `AccountDetail` entity into your Provider app. It uses the `MendixUserID` attribute of `AccountDetail` to populate the "sub" claim in the access token. For any other user claims you want to include in your access token, you need to create a microflow as described in [Configuration of the OIDC Provider to Propagate the End-User’s Identity with Custom Claims](#propagate-custom-claims), above.
409447

410448
There are two ways in OIDC Provider to get create accounts:
411449

@@ -420,3 +458,14 @@ This means that the access token will contain a "sub" claim which gets value fro
420458
This is the case where the OIDC Provider module can be used separately as an IDP without building an IAM structure.
421459

422460
Where there is no IAM brokering functionality, the administrator can create end-users (Accounts) using the AccountDetail page in the OIDC Provider module. This page creates `AccountDetail` objects which automatically create `Account` objects in the app to represent the AccountDetails as accounts.
461+
462+
### 7.4 Structure of ID and Access Tokens
463+
464+
For situations where the Centralized Authorization concept is used (see [Centralized Authorization](#centralized-auth), above), the OIDC Provider module uses the ‘scope’ claim in both the ID and Access token to communicate assigned user roles to connected Mendix apps. The scope parameter one of the following the formats:
465+
466+
* `mx:app:userrole:{user-role-UUID}`, where `{user-role-UUID}` is the UUID of the role in the connected app (version 1.1.0 and above)
467+
* `{user-role}`, where `{user-role}` is the name of the user role
468+
469+
These are set up in [Configuration of the OIDC Provider for Centralized Authorization with Scopes](#configure-scopes). Multiple scopes will be separated by spaces.
470+
471+
For example: `mx:app:userrole:53f5d6fa-6da9-4a71-b011-454ec052cce8 mx:app:userrole:6c5ea333-799c-4438-96fc-2528ced788e4`

0 commit comments

Comments
 (0)