Role Mapping for SSO Configuration

Role Mappings allow instellix roles to be assigned automatically when users sign in through Single Sign-On.

Mappings are based on claims provided by the identity provider.

Common examples include:

  • Azure AD Groups
  • Okta Groups
  • Email Domains
  • Department Attributes
  • Custom Claims

This eliminates the need for administrators to manually assign roles after a user's first login via SSO.


How Role Mapping Works

During login:

  1. The identity provider sends user claims
  2. instellix evaluates all configured mappings
  3. Matching instellix roles are assigned automatically.
  4. The user immediately receives the corresponding permissions

Accessing Role Mappings

Navigate to:

Configuration → Global → Access Management

Open an existing SSO configuration and select Add Role Mapping.


Creating a Role Mapping

Each mapping consists of three values:

FieldDescription
Claim or AttributeName of the claim received from the identity provider.
External ValueExpected value within the claim.
Target Roleinstellix role assigned when a match is found.
Sync ModeSync mode determines when role mappings are evaluated and applied.

Example: Mapping Azure Groups

Assume Azure AD sends the following claim:

{
  "groups": [
    "Developers",
    "Support"
  ]
}

Configure the mapping as follows:

FieldValue
Claim or Attributegroups
External ValueDevelopers
Target RoleProduct Manager

Result:

Every user belonging to the Azure group Developers automatically receives the Product Manager role in instellix.


Example: Mapping Email Domains

Some identity providers expose the user's email address.

Example claim:

{
  "email": "[email protected]"
}

Configure the mapping as follows:

FieldValue
Claim or Attributeemail
External Value@example.com
Target RoleAuditor

Result:

All users with an email address from the specified domain automatically receive the Auditor role.


Multiple Role Assignments

A user can match multiple mappings.

Example:

ClaimValueAssigned Role
groupsDevelopersProduct Manager
groupsFinanceFinance Manager

If both mappings match, the user receives both roles.


Available Target Roles

The list of available roles depends on the roles configured within your tenant. Further information on data reports can be found here.


Sync Mode

The Sync Mode determines when information received from the identity provider is synchronized with the local user account.

This includes all data managed by configured identity provider mappers, such as:

  • First name and last name
  • Email address
  • User attributes
  • Role mappings
Sync ModeDescriptionRecommended whenEffect on Changes
ImportImports user information and role mappings when the user signs in through SSO for the first time. Later changes in the identity provider are not synchronized automatically.Local user data may be modified after the initial import.Changes in the identity provider are not synchronized automatically. Local changes remain unchanged.
ForceSynchronizes user information and role mappings every time the user signs in. The identity provider remains the authoritative source for mapped data.User information and role assignments should always reflect the current state of the identity provider.Changes in the identity provider are applied during every login. Depending on the mapper, local changes may be overwritten and roles may be added or removed.
LegacyUses the synchronization behavior of older Keycloak versions. The exact behavior depends on the configured mapper and is intended for backward compatibility.Existing Keycloak configurations that rely on the previous synchronization behavior.Uses Keycloak's legacy synchronization behavior. Not recommended for new configurations.
InheritUses the Sync Mode configured for the identity provider. The mapper follows the provider's synchronization behavior instead of defining its own.Individual mappers should follow the provider-wide synchronization settings.The behavior depends entirely on the Sync Mode configured for the identity provider (for example Import or Force).

Note: The Sync Mode only determines when identity provider mappers are executed. Which user information is synchronized depends on the configured mapper.

Role Mappings

Role mappings behave differently depending on the selected Sync Mode.

  • Import applies role mappings only when a brokered user is created during the first login.
  • Force evaluates role mappings during every login, allowing roles to be added or removed based on the current claims provided by the identity provider.

Recommendation: Use Force if the identity provider should remain the authoritative source for user roles.


Best Practices

Use Groups Whenever Possible

Group-based mappings are easier to maintain than user-specific mappings.

Recommended:

groups = Developers → Product Manager

Not recommended:

email = [email protected] → Product Manager

Keep Role Assignments Simple

Assign permissions through identity provider groups and manage membership centrally within the identity provider.

Follow Least Privilege Principles

Only assign the permissions required for a user's responsibilities.


Troubleshooting

User Receives Unexpected Permissions

Review:

  • Overlapping mappings
  • Multiple matching claims
  • Group memberships in the identity provider

User receives no role

Verify that:

  • The user authenticates through the correct SSO provider
  • The configured claim exists in the token or SAML assertion
  • The external value matches exactly
  • Capitalization matches exactly
  • The target role still exists
  • The selected sync mode behaves as expected

Role changes are not synchronized

Verify that:

  • Sync Mode is set to Force
  • The user logged in again after the change
  • The claim values actually changed at the identity provider

Additional Information

The exact claims available for mapping depend on your identity provider configuration.

Refer to your identity provider documentation for information about:

  • Available claims
  • Group claims
  • Custom attributes
  • Token contents

Role mappings are evaluated on every login, ensuring permissions remain synchronized with your identity provider configuration.


Did this page help you?