7.5. Configure role assignment strategies#
With the trust relationship established between Nubus Keycloak and your upstream IdP, you must configure how Nubus assigns guardian roles to federated users. Two approaches are available for role assignment.
- Direct role attribute approach
The upstream IAM stores guardian roles directly in a user attribute and transfers them during authentication. This approach requires the upstream IAM to support a custom attribute but minimizes mapping complexity. See Direct role attribute approach.
- Group-based role assignment
Nubus derives guardian roles from the user’s group memberships in the upstream IAM. This approach avoids schema extensions but requires additional mapping configuration in both IdPs. See Group-based role assignment approach.
Choosing between the approaches depends on your upstream IAM capabilities. Use the direct approach if your upstream IAM allows custom attributes. Use the group-based approach if schema extensions aren’t possible, or you prefer managing roles through group membership.
Important
You must choose one of these approaches for your environment. The two approaches are mutually exclusive alternatives, not sequential configuration steps.
7.5.1. Direct role attribute approach#
Use this approach when your upstream IAM provides guardian roles
as a user attribute named nubus_roles.
The upstream IAM must expose nubus_roles as a multi-value attribute.
You must forward this attribute through the entire authentication chain.
This configuration requires minimal mapping logic because the upstream IAM provides the roles. However, your upstream IAM must support a suitable attribute for storing the Nubus guardian roles.
7.5.1.1. Upstream IdP#
Configure the upstream identity provider to include the nubus_roles attribute in
the OpenID Connect token.
Create an additional mapper for the OIDC client used for the trust
relationship with Nubus:
User AttributemapperUser Attribute:
nubus_rolesToken Claim Name:
nubus_rolesClaim JSON Type:
StringMultivalued:
true
This mapper ensures that the upstream IdP includes the
nubus_rolesclaim in the token returned after authentication.
7.5.1.2. Nubus IdP#
Nubus Keycloak must import the claim that the upstream IdP provides.
Create an Attribute Importer mapper in the OIDC identity provider
configuration:
Attribute ImportermapperClaim:
nubus_rolesUser Attribute:
nubus_rolesSync mode:
force
This mapper stores the role information from the upstream IdP as a user attribute in the Nubus Keycloak user object.
7.5.1.3. UMC OIDC clients#
You must forward the roles to the Management UI (UMC).
For each UMC OIDC client, create a User Attribute mapper:
User AttributemapperUser Attribute:
nubus_rolesToken Claim Name:
nubus_rolesClaim JSON Type:
StringMultivalued:
true
7.5.1.4. Authentication flow for direct roles#
With this configuration, the role information flows through the system as follows:
The user signs in at the upstream IdP.
The upstream IdP reads the
nubus_rolesattribute from the upstream IAM.The upstream IdP includes the roles in the OIDC token as the claim
nubus_roles.Nubus Keycloak imports this claim into the local user attribute
nubus_roles.The UMC OIDC client mapper includes this attribute in the token issued to UMC.
The Management UI (UMC) reads the
nubus_rolesclaim and uses the corresponding guardian roles for the session.
7.5.2. Group-based role assignment approach#
Use this approach when you can’t extend your upstream IAM with custom attributes. In this model:
Users in the upstream IAM are members of groups.
Each group represents a specific Nubus Guardian role.
The upstream IdP sends the user’s group memberships during sign-in.
Nubus Keycloak maps these groups to corresponding groups in the Nubus IdP.
These Nubus groups contain the guardian role definitions.
Role management remains fully controlled by group membership in the upstream IAM.
The group-based approach avoids schema extensions in the upstream IAM, making it suitable for environments where you can’t add custom attributes. Group membership centralizes role management and allows dynamic role updates.
However, this approach requires more complex mapping configuration in both the upstream IdP and Nubus Keycloak. For environments with many roles, consider automating the configuration to reduce maintenance burden.
7.5.2.1. Example structure#
The example in Listing 7.2
illustrates the mapping between upstream groups and Nubus guardian roles.
During sign-in,
membership in /nubus_manager_ou1 in the upstream IdP
results in membership in the group upstream_nubus_manager_ou1 in Nubus Keycloak.
This group provides the guardian role for the Management UI (UMC).
The configuration requires changes in both the upstream IdP and the Nubus IdP.
Upstream IdP:
User: manager-ou1
Group membership: nubus_manager_ou1
Path: /nubus_manager_ou1
Nubus IdP:
Group: upstream_nubus_manager_ou1
Attribute: nubus_roles
Value: udm:default-roles:organizational-unit-admin&udm:contexts:position=ou=ou1,dc=ucs,dc=test
7.5.2.2. Upstream IdP configuration#
Configure the upstream IdP to include group membership information in the issued OpenID Connect tokens.
Create a client scope named
groups.Add a mapper of type
Group Membershipthat maps the user’s groups to the token claimgroups.Add the
groupsscope as a default client scope for the OIDC client that you use for the trust relationship with Nubus.
After this configuration, the upstream IdP includes a claim similar to Listing 7.3.
{
"groups": [
"/nubus_manager_ou1"
]
}
7.5.2.3. Nubus IdP configuration#
In Nubus Keycloak, you must map the upstream group memberships to local groups. These mappers make users who sign in through the upstream IdP members of the corresponding group in Nubus Keycloak.
Create a client scope named
groups.Add the scope
groupsto the list of requested scopes in the OIDC identity provider configuration.For each upstream group that represents a Nubus role, create a local group and add the
nubus_rolesattribute.GroupName:
upstream_nubus_manager_ou1Attribute:
nubus_rolesValue:
udm:default-roles:organizational-unit-admin&udm:contexts:position=ou=ou1,dc=ucs,dc=test
For each upstream group that represents a Nubus role, create a mapper of type
Advanced Claim to Group.Advanced Claim to GroupmapperName:
group_/nubus_manager_ou1Sync mode override:
ForceClaims key:
groupsClaims value:
/nubus_manager_ou1Group:
upstream_nubus_manager_ou1
7.5.2.4. Providing guardian roles to UMC#
The mappers in the previous step Nubus IdP configuration synchronize group membership from the upstream IAM to local groups in the Nubus IdP, adding role information. You must include these roles in the tokens issued to the Management UI (UMC).
For each UMC OIDC client, create a client mapper that aggregates the
nubus_roles attributes from all user groups.
User Attributemapper:Name:
nubus_roles_from_groupsUser Attribute:
nubus_rolesToken Claim Name:
nubus_rolesClaim JSON Type:
StringMultivalued:
trueAggregate attribute values:
true
7.5.2.5. Sign-in flow for group-based roles#
With this configuration, the sign-in process works as follows:
The user signs in to the Management UI (UMC).
Nubus Keycloak redirects the user to the upstream IdP.
The upstream IdP signs the user in and returns the
groupsclaim.Nubus Keycloak maps the upstream groups to local groups.
The local groups contain the
nubus_rolesattribute.The UMC client mapper aggregates these roles.
Nubus sends the resulting
nubus_rolesclaim to the Management UI (UMC).The Management UI (UMC) applies the roles for delegative administration in the session.
7.5.2.6. Automating the configuration#
In environments with many roles, manually creating the group mappings and mappers is difficult to maintain. A common approach is to define a configuration that describes the mapping between upstream groups and Nubus roles and generate the required objects automatically.
See the example configuration in Listing 7.4. A script can use such a configuration to automatically create:
the corresponding groups in Nubus Keycloak.
the
nubus_rolesattributes on the group.the required
Advanced Claim to Groupmappers.
[
{
"upstream-group-name": "/nubus_manager_ou1",
"group-name": "upstream_nubus_manager_ou1",
"nubus-roles": "udm:default-roles:organizational-unit-admin&udm:contexts:position=ou=ou1,dc=ucs,dc=test"
},
{
"upstream-group-name": "/nubus_manager_ou2",
"group-name": "upstream_nubus_manager_ou2",
"nubus-roles": "udm:default-roles:organizational-unit-admin&udm:contexts:position=ou=ou2,dc=ucs,dc=test"
}
]