Files
kms/docs/documentation/platform/sso/keycloak-oidc/overview.mdx
zeekay 0ebffbd529 fix: white-label KMS branding and fix broken identifiers
- Fix 381 files where branding script corrupted variable names
  (e.g. isHanzo KMSTemplate -> isKmsTemplate)
- Rebrand from "Hanzo KMS" to just "KMS" for white-label support
  (allows Lux KMS, Hanzo KMS, etc. via configuration)
- 856 files, purely string replacements, no logic changes
2026-02-13 10:25:11 -08:00

120 lines
6.2 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "Keycloak OIDC Overview"
sidebarTitle: "Overview"
description: "Learn how to configure Keycloak OIDC for KMS SSO."
---
<Info>
Keycloak OIDC SSO is a paid feature. If you're using KMS Cloud, then it
is available under the **Pro Tier**. If you're self-hosting KMS, then
you should contact [email protected] to purchase a self-hosted license to
use it.
</Info>
<Steps>
<Step title="Create an OIDC client application in Keycloak">
1.1. In your realm, navigate to the **Clients** tab and click **Create client** to create a new client application.
![OIDC keycloak list of clients](/images/sso/keycloak-oidc/clients-list.png)
<Info>
You don’t typically need to make a realm dedicated to KMS. We recommend adding KMS as a client to your primary realm.
</Info>
1.2. In the General Settings step, set **Client type** to **OpenID Connect**, the **Client ID** field to an appropriate identifier, and the **Name** field to a friendly name like **KMS**.
![OIDC keycloak create client general settings](/images/sso/keycloak-oidc/create-client-general-settings.png)
1.3. Next, in the Capability Config step, ensure that **Client Authentication** is set to On and that **Standard flow** is enabled in the Authentication flow section.
![OIDC keycloak create client capability config settings](/images/sso/keycloak-oidc/create-client-capability.png)
1.4. In the Login Settings step, set the following values:
- Root URL: `https://kms.hanzo.ai`.
- Home URL: `https://kms.hanzo.ai`.
- Valid Redirect URIs: `https://kms.hanzo.ai/api/v1/sso/oidc/callback`.
- Web origins: `https://kms.hanzo.ai`.
![OIDC keycloak create client login settings](/images/sso/keycloak-oidc/create-client-login-settings.png)
<Info>
If you’re self-hosting KMS, then you will want to replace https://kms.hanzo.ai (base URL) with your own domain.
</Info>
1.5. Next, navigate to the **Client scopes** tab and select the client's dedicated scope.
![OIDC keycloak client scopes list](/images/sso/keycloak-oidc/client-scope-list.png)
1.6. Next, click **Add predefined mapper**.
![OIDC keycloak client mappers empty](/images/sso/keycloak-oidc/client-scope-mapper-menu.png)
1.7. Select the **email**, **given name**, **family name** attributes and click **Add**.
![OIDC keycloak client mappers predefined 1](/images/sso/keycloak-oidc/scope-predefined-mapper-1.png)
![OIDC keycloak client mappers predefined 2](/images/sso/keycloak-oidc/scope-predefined-mapper-2.png)
Once you've completed the above steps, the list of mappers should look like the following:
![OIDC keycloak client mappers completed](/images/sso/keycloak-oidc/client-scope-complete-overview.png)
</Step>
<Step title="Retrieve Identity Provider (IdP) Information from Keycloak">
2.1. Back in Keycloak, navigate to Configure > Realm settings > General tab > Endpoints > OpenID Endpoint Configuration and copy the opened URL. This is what is to referred to as the Discovery Document URL and it takes the form: `https://keycloak-mysite.com/realms/myrealm/.well-known/openid-configuration`.
![OIDC keycloak realm OIDC metadata](/images/sso/keycloak-oidc/realm-setting-oidc-config.png)
2.2. From the Clients page, navigate to the Credential tab and copy the **Client Secret** to be used in the next steps.
![OIDC keycloak realm OIDC secret](/images/sso/keycloak-oidc/client-secret.png)
</Step>
<Step title="Finish configuring OIDC in KMS">
3.1. Back in KMS, head to the **Single Sign-On (SSO)** page and select the **General** tab. Click **Connect** for **OIDC**.
![OIDC SSO Connect](../../../../images/sso/connect-oidc.png)
3.2. For configuration type, select Discovery URL. Then, set the appropriate values for **Discovery Document URL**, **JWT Signature Algorithm**, **Client ID**, and **Client Secret**.
![OIDC keycloak paste values into KMS](/images/sso/keycloak-oidc/create-oidc.png)
<Info>
Currently, the following JWT signature algorithms are supported: RS256, RS512, HS256, and EdDSA
</Info>
Once you've done that, press **Update** to complete the required configuration.
</Step>
<Step title="Enable OIDC SSO in KMS">
Enabling OIDC SSO allows members in your organization to log into KMS via Keycloak.
![OIDC keycloak enable OIDC](/images/sso/enable-oidc.png)
</Step>
<Step title="Enforce OIDC SSO in KMS">
Enforcing OIDC SSO ensures that members in your organization can only access KMS
by logging into the organization via Keycloak.
To enforce OIDC SSO, you're required to test out the OpenID connection by successfully authenticating at least one Keycloak user with KMS.
Once you've completed this requirement, you can toggle the **Enforce OIDC SSO** button to enforce OIDC SSO.
<Warning>
We recommend ensuring that your account is provisioned using the application in Keycloak
prior to enforcing OIDC SSO to prevent any unintended issues.
</Warning>
<Info>
In case of a lockout, an organization admin can use the [Admin Login Portal](https://kms.hanzo.ai/docs/documentation/platform/sso/overview#admin-login-portal) in the `/login/admin` path e.g. https://kms.hanzo.ai/login/admin.
</Info>
</Step>
</Steps>
<Tip>
If you are only using one organization on your KMS instance, you can configure a default organization in the [Server Admin Console](/documentation/platform/admin-panel/server-admin#default-organization) to expedite OIDC login.
</Tip>
<Note>
If you're configuring OIDC SSO on a self-hosted instance of KMS, make
sure to set the `AUTH_SECRET` and `SITE_URL` environment variable for it to
work:
<div class="height:1px;"/>
- `AUTH_SECRET`: A secret key used for signing and verifying JWT. This
can be a random 32-byte base64 string generated with `openssl rand -base64
32`.
<div class="height:1px;"/>
- `SITE_URL`: The absolute URL of your self-hosted instance of KMS including the protocol (e.g. https://kms.hanzo.ai)
</Note>