The following instructions were generated following the Administration Console view in version Keycloak 12.0.2. The location of the tabs might differ starting with version 18.0.0.
Create a custom scope
Open the Keycloak administration console
Open the “Client Scopes” tab
Click “Create”
Enter the following information:
Name: modelop_client
Description: A ModelOp custom scope used to distinguish between an OAuth2 client and an end-user
Protocol: openid-connect
Display On Consent Screen: OFF
Include in Token Scope: ON
GUI order:
Click “Save”
Create a group mapper
Open the Keycloak administration console
Open the “User Federation” tab
Select the LDAP provider
Open the “Mappers” tab
Click “Create”
Enter the following information:
Name: modelOpGroups
Mapper Type: user-attribute-ldap-mapper
User Model Attribute: memberOf
LDAP Attribute: <Enter the name of the mapped attribute on LDAP object containing the user’s groups>
Read Only: ON
Always Read Value From LDAP: ON
Is Mandatory in LDAP: OFF
Is Binary Attribute: OFF
Click “Save”
Once the group mapper is defined, it needs to be applied to all users by following these steps, starting with “Step 3. Select the LDAP provider” listed above:
Open the “Settings” tab
Click “Synchronize all users”
Create a group mapper with a hardcoded value
Open the Keycloak administration console
Open the “User Federation” tab
Select the LDAP provider
Open the “Mappers” tab
Click “Create”
Enter the following information:
Name: modelOpGroups
Mapper Type: hardcoded-attribute-mapper
User Model Attribute Name: memberOf
Attribute Value: modelop
Click “Save”
Official Keycloak Resources
The following links from the official Keycloak documentation are excellent resources that cover the topics and settings required for ModelOp Center: