7.3. Establish trust between Nubus and the upstream IdP#
Next, establish a trust relationship between Nubus Keycloak and the upstream identity provider.
The exact configuration depends on the upstream IAM and identity provider. This section provides a generic overview using a concrete example where both identity providers are Keycloak instances and both establish trust using OpenID Connect (OIDC). All configuration steps in this section refer to the Keycloak Admin Console.
For detailed information about identity brokering in Keycloak, see Integrating identity providers in in Keycloak Server Administration Guide [7].
7.3.1. Upstream IdP configuration#
First, create an OIDC client in the upstream identity provider that Nubus Keycloak uses for authentication.
This client must provide a stable identifier for each user.
Map this identifier to the claim nubus_id.
Suitable identifiers include:
guidin Active DirectoryuniventionObjectIdentifierin Nubusanother globally unique user identifier
Configure a User Attribute mapper for the client:
User AttributemapperUser Attribute: The attribute containing the unique user identifier
Token Claim Name:
nubus_idClaim JSON Type:
String
This mapper ensures that the upstream IdP includes the
nubus_idclaim in the issued OIDC token.
7.3.2. Nubus Keycloak identity provider configuration#
In the Nubus Keycloak realm ucs,
create an OpenID Connect Identity Provider pointing to the upstream IdP.
In addition to the standard OIDC settings,
you must configure several mappers to correctly handle federated users.
Hardcoded AttributemapperUser Attribute:
nubus_federated_accountAttribute Value:
true
This attribute marks the user as a federated account so that the Management UI (UMC) can apply the appropriate handling.
Attribute ImportermapperClaim:
nubus_idUser Attribute:
nubus_idSync mode:
force
This mapper imports the unique identifier from the upstream IdP into the local Keycloak user object.
Username Template ImportermapperTemplate:
${ALIAS}.${CLAIM.nubus_id}Target:
local
With this configuration, the generated username combines the identity provider alias and the upstream user identifier, for example:
myUpstreamIDP.4f0fdab5-2979-4b25-87b7-5ecdf623547e
Keycloak requires several user attributes such as email,
firstName, and lastName.
Because this feature minimizes the amount of user data transferred from the upstream IAM,
you populate these attributes with the value of nubus_id.
Create the following Attribute Importer mappers:
Attribute ImportermapperName:
override_emailClaim:
nubus_idUser Attribute:
emailSync mode:
force
Attribute ImportermapperName:
override_lastnameClaim:
nubus_idUser Attribute:
lastNameSync mode:
force
Attribute ImportermapperName:
override_firstnameClaim:
nubus_idUser Attribute:
firstNameSync mode:
force
Because Keycloak populates the email attribute with a UUID instead of a valid
email address, you must relax the default Keycloak email validation.
To adjust the validation:
Open Realm settings in the
ucsrealm.Navigate to User profile.
Edit the
emailattribute.Remove the
emailvalidation rule.
This allows Keycloak to store UUID values in the email attribute.