> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getbifrost.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# SSO using OIDC

> Configure Keycloak as your identity provider for Bifrost Enterprise using OpenID Connect.

## Prerequisites

* A running Keycloak server (self-hosted or cloud) with admin access to a realm
* Bifrost Enterprise deployed and accessible
* Your Bifrost callback URL: `https://<your-bifrost-domain>/login` (under a `server.base_path` prefix: `https://<your-bifrost-domain>/<prefix>/login`; the SSO wizard shows the exact value)

***

## Step 1: Create an OIDC Client

**1. Open the Clients list**

In the Keycloak Admin Console, select your realm from the top-left dropdown.

Go to **Clients** in the left nav and click **Create client**.

![Keycloak Admin Console Clients list with Create client button highlighted](https://mintcdn.com/bifrost/t2xGvkL5ieUlU35Z/media/user-provisioning/keycloak/keycloak-create-client.png?fit=max\&auto=format\&n=t2xGvkL5ieUlU35Z\&q=85\&s=3cc912951088baccfd6cee5bf91fb38e)

The Clients list - click Create client to start.

**2. Fill in General settings**

Set the following fields:

* **Client type**: OpenID Connect
* **Client ID**: `bifrost-oidc` (or any identifier you prefer)
* **Name**: `Bifrost`

Click **Next**.

![Keycloak Create client General settings form with Client type OpenID Connect, Client ID bifrost-oidc, and Name Bifrost](https://mintcdn.com/bifrost/t2xGvkL5ieUlU35Z/media/user-provisioning/keycloak/keycloak-client-creation.png?fit=max\&auto=format\&n=t2xGvkL5ieUlU35Z\&q=85\&s=3352416f4fd1b94fc32267f3848407f9)

General settings - set Client type to OpenID Connect and provide a Client ID.

**3. Configure Capability config**

On the **Capability config** step, enable:

* **Client authentication** - makes this a confidential client and generates a client secret
* **Standard flow** - enables Authorization Code login
* **Service accounts roles** - required for Bifrost to call the Keycloak Admin REST API for background user sync

Leave all other toggles at their defaults. Click **Next**.

**4. Configure Login settings**

Set your redirect URIs:

* **Root URL**: `https://<your-bifrost-domain>`
* **Valid redirect URIs**: `https://<your-bifrost-domain>/login` (or `https://<your-bifrost-domain>/<prefix>/login` under a `server.base_path`)

Optionally, to use Discover Claims during setup, also add:

```
https://<your-bifrost-domain>/workspace/scim/oauth-discover-callback
```

Under a `server.base_path` prefix, insert it before the path: `https://<your-bifrost-domain>/<prefix>/workspace/scim/oauth-discover-callback`.

Click **Save**.

![Keycloak Login settings form with Root URL, Valid redirect URIs showing the Bifrost login and oauth-discover-callback URLs](https://mintcdn.com/bifrost/t2xGvkL5ieUlU35Z/media/user-provisioning/keycloak/keycloak-login-settings.png?fit=max\&auto=format\&n=t2xGvkL5ieUlU35Z\&q=85\&s=0be8ee68688e97e26561ca784f8cd3eb)

Login settings - add your Bifrost login URL and optionally the Discover Claims callback URI.

**5. Grant Admin REST API permissions to the service account**

The client is now saved. Open it and go to the **Service accounts roles** tab.

Click **Assign role**, filter by `realm-management`, and assign:

| Role | Required |
| - | - |
| `view-users` | Required - lets Bifrost list and import users |
| `view-realm` | Recommended - enables group and role listing |
| `query-groups` | Optional - needed for group-based import filters |

These permissions power the **Sync Users from Keycloak** import flow in [Optional Next Steps](#optional-next-steps).

***

## Step 2: Copy Your Client Secret

**1. Open the Credentials tab**

Open the **bifrost-oidc** client and go to the **Credentials** tab.

Copy the **Client Secret** - you will need it in [Step 5](#step-5-configure-bifrost).

![Keycloak Credentials tab showing Client Authenticator set to Client Id and Secret with the Client Secret field](https://mintcdn.com/bifrost/t2xGvkL5ieUlU35Z/media/user-provisioning/keycloak/keycloak-client-config.png?fit=max\&auto=format\&n=t2xGvkL5ieUlU35Z\&q=85\&s=2d2da4cfcf36de8f00827f4b97fa87ab)

Credentials tab - copy the Client Secret.

***

## Step 3: Configure Claim Mappers

Keycloak does not include realm roles or full group paths in tokens by default. Add two mappers to the client's dedicated scope.

**1. Open the dedicated scope**

In the **bifrost-oidc** client, go to the **Client scopes** tab.

Click on the **bifrost-oidc-dedicated** scope.

![Keycloak Client scopes tab with bifrost-oidc-dedicated scope highlighted](https://mintcdn.com/bifrost/t2xGvkL5ieUlU35Z/media/user-provisioning/keycloak/keycloak-client-scopes.png?fit=max\&auto=format\&n=t2xGvkL5ieUlU35Z\&q=85\&s=1ecbab2a0acbe810181a80a7d8ede808)

Client scopes tab - open the dedicated scope to add mappers.

**2. Add the Group Membership mapper**

Click **Add mapper** → **By configuration**.

![Keycloak Configure a new mapper dialog showing mapper type list with Group Membership visible](https://mintcdn.com/bifrost/t2xGvkL5ieUlU35Z/media/user-provisioning/keycloak/keycloak-configure-new-mapper.png?fit=max\&auto=format\&n=t2xGvkL5ieUlU35Z\&q=85\&s=b01318dc936a4b5a854f55eef65aa5b0)

Configure a new mapper - select Group Membership from the list.

Select **Group Membership** and configure it:

| Field | Value |
| - | - |
| **Name** | `Groups` |
| **Token Claim Name** | `groups` |
| **Full group path** | **On** |
| **Add to ID token** | **On** |
| **Add to access token** | **On** |
| **Add to userinfo** | **On** |

Click **Save**.

![Group Membership mapper form with Name Groups, Token Claim Name groups, Full group path On, and all Add to token toggles On](https://mintcdn.com/bifrost/t2xGvkL5ieUlU35Z/media/user-provisioning/keycloak/keycloak-groups-mapping.png?fit=max\&auto=format\&n=t2xGvkL5ieUlU35Z\&q=85\&s=1feaa7827ac5bd8a187016fb3bb9f8c7)

Group Membership mapper - Full group path must be On so Bifrost receives paths like /Engineering instead of just Engineering.

> [!NOTE]
>
> Keep **Full group path** enabled. Keycloak sends groups as paths (e.g. `/Engineering`, `/Platform`). Bifrost's `/${*}` wildcard in team mappings extracts the name after the slash automatically - see [Step 5](#step-5-configure-bifrost).

**3. Add the User Realm Role mapper**

Click **Add mapper** → **By configuration** again.

Select **User Realm Role** from the list.

![Keycloak Configure a new mapper dialog with User Realm Role option highlighted](https://mintcdn.com/bifrost/t2xGvkL5ieUlU35Z/media/user-provisioning/keycloak/keycloak-realm-role-mapping.png?fit=max\&auto=format\&n=t2xGvkL5ieUlU35Z\&q=85\&s=a38d194337b202bc721220a5f057f19a)

Select User Realm Role from the mapper list to expose realm roles in the JWT.

Configure it:

| Field | Value |
| - | - |
| **Name** | `realm_roles` |
| **Token Claim Name** | `realm_access.roles` |
| **Claim JSON Type** | String |
| **Multivalued** | **On** |
| **Add to ID token** | **On** |
| **Add to access token** | **On** |

Click **Save**.

![User Realm Role mapper form with Name realm\_roles, Token Claim Name realm\_access.roles, Multivalued On, and Add to ID and access token enabled](https://mintcdn.com/bifrost/t2xGvkL5ieUlU35Z/media/user-provisioning/keycloak/keycloak-realm-role-config.png?fit=max\&auto=format\&n=t2xGvkL5ieUlU35Z\&q=85\&s=7bb78955ecdc2494f8ef61015f76bd05)

User Realm Role mapper - Token Claim Name realm\_access.roles matches the dotted path Bifrost uses for role lookup.

***

## Step 4: Assign Users

In Keycloak, users need to be assigned to the realm roles and groups you plan to map in Bifrost.

* Go to **Users** → select a user → **Role mapping** tab → assign the relevant realm roles (e.g. `realm-admin`, `bifrost-viewer`)
* Go to **Users** → select a user → **Groups** tab → join the relevant groups (e.g. `/Engineering`, `/Platform`)

***

## Step 5: Configure Bifrost

**1. Open User Provisioning and choose Keycloak**

In your Bifrost dashboard, go to **Governance** → **User Provisioning**.

Select **Keycloak** as the identity provider and click **Next**.

![Bifrost Choose Provider screen with Keycloak card selected](https://mintcdn.com/bifrost/t2xGvkL5ieUlU35Z/media/user-provisioning/keycloak/bifrost-user-provisioning.png?fit=max\&auto=format\&n=t2xGvkL5ieUlU35Z\&q=85\&s=bfc3b2be1f9fa7f67367caa8eaa566c9)

Select Keycloak from the list of identity providers.

**2. Fill in the provider configuration**

Enter the details from the previous steps:

* **Server URL**: your Keycloak base URL - no `/realms/...` suffix (e.g. `https://keycloak.company.com`)
* **Realm**: your realm name (e.g. `Bifrost`)
* **Client ID**: the client ID you set in Step 1 (e.g. `bifrost-oidc`)
* **Client Secret**: copied from [Step 2](#step-2-copy-your-client-secret)
* **Audience**: optional - leave blank to default to the Client ID
* **Team IDs Field (Optional)**: leave as `groups` to match the mapper you created in Step 3

Click **Verify & Next** to confirm the connection.

![Bifrost Provider Configuration form for Keycloak with Server URL, Realm, Client ID, Client Secret, and Team IDs Field filled in](https://mintcdn.com/bifrost/t2xGvkL5ieUlU35Z/media/user-provisioning/keycloak/bifrost-keycloak-provider-config.png?fit=max\&auto=format\&n=t2xGvkL5ieUlU35Z\&q=85\&s=3ec6fb14ed634fcc2adef5f2a1b557d3)

Provider Configuration - enter your Keycloak Server URL, Realm, Client ID, and Client Secret.

**3. Discover claims**

On the Attribute Mapping screen, click **Discover Claims**.

Bifrost opens a sign-in popup with your Keycloak realm - no session is created.

Once you authenticate, it returns the exact claims your Keycloak tenant is sending in the JWT. Confirm that `groups` and `realm_access.roles` appear before building your mappings.

![Bifrost Discover Claims screen showing claims including email, groups with /Engineering and /Platform paths, and realm\_access with roles array](https://mintcdn.com/bifrost/t2xGvkL5ieUlU35Z/media/user-provisioning/keycloak/bifrost-keycloak-discover-claims.png?fit=max\&auto=format\&n=t2xGvkL5ieUlU35Z\&q=85\&s=043c54ed4af32ab1a34ab55bcdfea879)

Discover Claims shows the live JWT from Keycloak - confirm groups (full paths) and realm\_access.roles are present.

**4. Set up attribute mappings**

Use the sections below the claim list to map Keycloak claim values to Bifrost roles, teams, and business units.

**Attribute-to-Role Mappings**

Map a claim value to a Bifrost role. All matching rules are evaluated. If several rules match, Bifrost picks one using your chosen resolution strategy:

* **The role with the most permissions** (default)
* **The first matching role, by list order** (drag rows to set priority)

If no rule matches, no role is assigned and login is denied.

Example: map `realm_access.roles` → `realm-admin` → **Admin**, and `realm_access.roles` → `bifrost-viewer` → **Viewer**.

**Attribute-to-Team Mappings**

Map a claim value to a Bifrost team. All matching rules apply. Three value formats work:

* **Exact value** - e.g. `/Engineering` maps that specific group to a fixed team name
* **`*`** - syncs the claim value directly as the team name
* **`/${*}`** - extracts the group name from Keycloak's full group path - e.g. `/${*}` matches `/Engineering` and creates team **Engineering**, and matches `/Platform` and creates team **Platform**

**Attribute-to-Business Unit Mappings**

Same wildcard support as team mappings. Three value formats work:

* **Exact value** - maps a specific claim value to a fixed business unit name
* **`*`** - syncs the claim value directly as the business unit name
* **`/${*}`** - extracts the group name from Keycloak's full group path, same as team mappings (e.g. `/${*}` on `/Engineering` → business unit **Engineering**)
* When a rule matches, the resolved business unit is assigned to the user. All matching rules apply, so a user can belong to several business units at once
* A business unit you assign by hand stays until you remove it, unless a mapping later grants the same one, in which case it follows your IdP. One granted from a claim is removed at a later sign-in where the attribute is present and no longer matches; a refreshed token that leaves the attribute out entirely doesn't remove it

![Bifrost Attribute Mapping screen showing realm\_access.roles mapped to Admin and Viewer roles, and groups mapped with /\$\{\*} wildcard to extract team names](https://mintcdn.com/bifrost/t2xGvkL5ieUlU35Z/media/user-provisioning/keycloak/bifrost-keycloak-attribute-mapping.png?fit=max\&auto=format\&n=t2xGvkL5ieUlU35Z\&q=85\&s=dd12ae45a4227bf6d5dc478aaa59f9bc)

Attribute Mapping - role rules use realm\_access.roles, team rules use groups with /\$\{\*} to extract the team name from Keycloak's full group path.

Click **Next** when done.

**5. Review and enable**

Review your configuration on the final screen and click **Enable**.

> [!WARNING]
>
> Restart your Bifrost server after enabling for the changes to take effect.

***

## Optional Next Steps

**Import users from Keycloak** - once SSO is configured, you can bulk-import users from Keycloak into Bifrost without waiting for each user to log in. Go to **Governance** → **Users** → **Sync Users from Keycloak** and filter by group or realm role to preview and import matching users.

![Sync Users from IdP dialog showing Filter by Groups with Engineering, Operations, and Platform checkboxes, and Filter by Roles section](https://mintcdn.com/bifrost/t2xGvkL5ieUlU35Z/media/user-provisioning/keycloak/bifrost-sync-users.png?fit=max\&auto=format\&n=t2xGvkL5ieUlU35Z\&q=85\&s=aacca22d46c5268273255649f7de4bae)

Sync Users from Keycloak - filter by group membership or realm role to select which users to import into Bifrost.

Imported users appear in **Governance** → **Users** with their role and team assignments applied immediately.

![Bifrost Users page showing a user with Admin role and Engineering and Platform teams, marked Managed by Keycloak](https://mintcdn.com/bifrost/t2xGvkL5ieUlU35Z/media/user-provisioning/keycloak/bifrost-users-page.png?fit=max\&auto=format\&n=t2xGvkL5ieUlU35Z\&q=85\&s=a5bb2d129da0c57eb6081c30495434a1)

Users page after syncing - users are marked Managed by Keycloak and receive their roles and teams from the attribute mappings.

***

## Troubleshooting

**`serverUrl must not include /realms/{realm}`** - the Server URL field takes the base Keycloak URL only. Set the realm separately in the Realm field. Example: `https://keycloak.company.com` + Realm `Bifrost` - not `https://keycloak.company.com/realms/Bifrost`.

**Users are redirected back to login** - confirm the client's **Valid redirect URIs** exactly match your Bifrost login URL (trailing slash matters). Verify the client is **Enabled** in Keycloak.

**Roles not appearing in the token** - check that the **User Realm Role** mapper adds to both ID and access tokens. Use **Evaluate** on the client scope in Keycloak to preview the token a specific user would receive.

**Groups not appearing in the token** - verify the **Group Membership** mapper has **Full group path** enabled and is added to ID token, access token, and userinfo.

**`jwks keys not found`** - confirm the Server URL is reachable from Bifrost. The JWKS endpoint is `{serverUrl}/realms/{realm}/protocol/openid-connect/certs`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.