Skip to content

Signing up with Keycloak

This page creates your XplicitTrust tenant with a Keycloak realm as the identity provider.

In short

Create an OpenID Connect client in your realm, give it the roles admin and user, add a groups and a roles mapper, create the groups XplicitTrust Administrators and XplicitTrust Users, and sign up with the client ID, client secret and issuer URL.

Overview

XplicitTrust signs users in through a Keycloak client. The role of a user comes from the roles claim of the ID token, the group memberships from the groups claim. XplicitTrust also reads users and groups through the Keycloak service account of the client, for the group import.

Prerequisites

  • A Keycloak instance.
  • Administrator access to the relevant Realm.

Configure Keycloak

Step 1: Create and configure the client

Create a new Client under the Realm you want to use. Follow the configuration tabs below:

  1. Set Client type to OpenID Connect.
  2. Choose a ClientID (e.g., XplicitTrust) and a Name.
  3. Important: Note down the Client ID for later.

    General Settings

  1. Enable Client authentication.
  2. Under Authentication flow, select:
    • Standard flow
    • Service account roles
    • OAuth 2.0 Device Authorization Grant
  3. As PKCE Method, select S256.
  4. Click Save.

    Capability Config

All three authentication flows are required

Without OAuth 2.0 Device Authorization Grant, the sign-up does not finish and stays at Waiting for Keycloak to complete authentication.

  1. Locate the Valid Redirect URIs field.
  2. Copy and paste the following URL:

    https://api.xplicittrust.com:443/v1.0/auth/callback/oidc
    

    Login Settings

Step 2: Credentials and roles

  1. Navigate to the Credentials tab and copy the Client Secret. You will need it for the sign-up.
  2. Navigate to the Roles tab and create two new roles:

    • admin (grants administrative access to the XplicitTrust Admin Console)
    • user (allows users to sign in at the XplicitTrust Agent)

    Client Roles

  3. Navigate to Service Account Roles. This tab only appears after Client authentication and Service account roles have been enabled and saved in Step 1.

    • Click Assign Role.
    • Filter by client realm-management.
    • Assign the following roles: query-groups, view-users.

    Service Account Roles

Step 3: Configure scopes and mappers

Navigate to Client Scopes and click on the XplicitTrust-dedicated scope (usually named <Client-ID>-dedicated).

Empty mapper list

As long as the dedicated scope has no mappers, Keycloak shows the buttons Configure a new mapper and Add predefined mapper instead of the Add mapper menu.

  1. Click Add mapper → By configuration (on an empty list: Configure a new mapper).
  2. Select Group Membership.
  3. Configure:

    • Name: groups
    • Token Claim Name: groups

    Group Mapper

  1. Click Add mapper → From predefined mappers (on an empty list: Add predefined mapper).
  2. Select client roles and click Add.
  3. Open the new mapper client roles and edit it:

    • Client ID: select the client you created in Step 1 (e.g., XplicitTrust).
    • Token Claim Name: roles. The field is prefilled with resource_access.${client_id}.roles. Replace this value.
    • Enable Add to ID token.
    • Enable Add to lightweight access token.

    Role Mapper

  1. Switch to the Scope tab.
  2. Disable Full scope allowed. The switch takes effect immediately, there is no Save button.
  3. Assign the following roles from realm-management:

    • query-groups
    • view-users

    Scope Settings

Step 4: Groups

  1. Navigate to the main Groups page in the sidebar.
  2. Create two groups: XplicitTrust Administrators and XplicitTrust Users.
  3. Edit each group and assign the Client Roles you created earlier (admin or user) to the corresponding group:
    • Open the group, switch to the Role mapping tab and click Assign role → Client roles.
    • The dialog only lists the first 20 roles of all clients. Use the search field (e.g., admin) or the paging controls to find the roles of your client, and check the Client ID column.
  4. Add your actual users to these groups now.

Users need an email address with the domain of the tenant

XplicitTrust uses the domain of a user's email address (the part after the @) to detect which Identity Provider the authentication has to be redirected to. Make sure that every user in Keycloak has an Email address set, and that all users of a tenant use the same email domain.

Roles and admins

Roles are client roles of the client you created, sent in the roles claim of the ID token:

Keycloak group Client role XplicitTrust role
XplicitTrust Administrators admin Admin: may sign in to the Admin Console
XplicitTrust Users user User: may sign in with the Agent

To make someone an admin, add the user to the group XplicitTrust Administrators. See Roles and groups by IdP.

Groups

Supported. The Group Membership mapper sends the groups in the groups claim. The service account roles query-groups and view-users let XplicitTrust import your Keycloak groups and use them in policies, next to the groups you create in XplicitTrust.

Sign up in XplicitTrust

Gather the information

Field Where to find it
Client ID Step 1
Client Secret Credentials tab of the client, Step 2
Issuer URL Realm Settings → General: click the link OpenID Endpoint Configuration and copy the value inside "issuer": "...". It has the form https://<keycloak-host>/realms/<realm>.

Connect XplicitTrust

  1. Visit the signup page: https://console.xplicittrust.com/#/signup/keycloak
  2. Enter the three values.

    Sign Up Screen Sign Up Screen

  3. Click Signup and follow the OpenID Connect login process.

Verify

You are signed in to the XplicitTrust Admin Console at https://console.xplicittrust.com/.

You can also check the token in Keycloak, before or after the sign-up:

  1. Open your client and navigate to Client Scopes → Evaluate.
  2. Select one of your administrators in the Users field.
  3. Click Generated ID token.
  4. Check that the token contains the user's email, the groups claim and the roles claim:

    "groups": [
      "/XplicitTrust Administrators"
    ],
    "roles": [
      "admin"
    ],
    "email": "admin@example.com"
    

Next steps

Verify your domain and review the sign-in settings: see Authentication and the After sign-up checklist.

Troubleshooting

Symptom Cause Fix
The sign-up stays at Waiting for Keycloak to complete authentication OAuth 2.0 Device Authorization Grant is not enabled for the client Enable it under Settings → Capability config (Step 1)
After the Keycloak login: Oops, That Didn't Work with an Error ID The ID token does not contain the roles claim Add the Role Mapper (Step 3) and check the token (Verify)
The roles claim also contains roles such as manage-account No Client ID is selected in the Role Mapper, or Full scope allowed is still enabled Select your client in the Role Mapper and disable Full scope allowed (Step 3)
The Service Account Roles or Credentials tab is missing Client authentication or Service account roles is not enabled Enable both under Capability config and click Save (Step 1)

To see why a login fails on the Keycloak side, enable Realm Settings → Events → User events settings → Save events and check Events after the next attempt.

See also