> ## Documentation Index
> Fetch the complete documentation index at: https://siderolabs-fe86397c-config-evolution.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Configure Keycloak for Omni

> Steps to integrate Keycloak with Omni using SAML authentication.

1. Log in to Keycloak.
2. Create a realm.

* In the upper left corner of the page, select the dropdown where it says **master**

<img src="https://mintcdn.com/siderolabs-fe86397c-config-evolution/UyHx5qHlTy4tqJ3A/omni/self-hosted/images/configure-keycloak-for-omni-create-realm.png?fit=max&auto=format&n=UyHx5qHlTy4tqJ3A&q=85&s=a04c3ebbaca87013a7b2189d4b30c463" alt="" width="1830" height="682" data-path="omni/self-hosted/images/configure-keycloak-for-omni-create-realm.png" />

* Fill in the **realm name** and select **create**

<img src="https://mintcdn.com/siderolabs-fe86397c-config-evolution/UyHx5qHlTy4tqJ3A/omni/self-hosted/images/configure-keycloak-for-omni-omni-create.png?fit=max&auto=format&n=UyHx5qHlTy4tqJ3A&q=85&s=1f6cc4894161073e4fbe7d82e7abd245" alt="" width="1839" height="680" data-path="omni/self-hosted/images/configure-keycloak-for-omni-omni-create.png" />

3. Select **Realm settings** in the sidebar, and navigate to the **Endpoints > SAML 2.0 Identity Provider Metadata** Link. The link should look a lot similar to this:

   ```bash theme={null}
   https://<keycloak-domain>/realms/<realm>/protocol/saml/descriptor
   ```

   * Copy the link or save its XML data to a file. You will need this for your Omni installation.

<img src="https://mintcdn.com/siderolabs-fe86397c-config-evolution/UyHx5qHlTy4tqJ3A/omni/self-hosted/images/configure-keycloak-saml-idp.png?fit=max&auto=format&n=UyHx5qHlTy4tqJ3A&q=85&s=7710defaa785e25502bc4ea26a0fdc47" alt="" width="3008" height="1792" data-path="omni/self-hosted/images/configure-keycloak-saml-idp.png" />

4. Create a client

* Select the **Clients** tab on the left

<img src="https://mintcdn.com/siderolabs-fe86397c-config-evolution/UyHx5qHlTy4tqJ3A/omni/self-hosted/images/configure-keycloak-for-omni-create-client.png?fit=max&auto=format&n=UyHx5qHlTy4tqJ3A&q=85&s=be91b98ab6c98de7076dbe498d3c80b3" alt="" width="1838" height="680" data-path="omni/self-hosted/images/configure-keycloak-for-omni-create-client.png" />

* Fill in the **General Settings** as shown in the example below. **Replace the hostname in the example with your own Omni hostname or IP**.
  * Client type
  * Client ID
  * Name

<img src="https://mintcdn.com/siderolabs-fe86397c-config-evolution/UyHx5qHlTy4tqJ3A/omni/self-hosted/images/configure-keycloak-for-omni-SAML.png?fit=max&auto=format&n=UyHx5qHlTy4tqJ3A&q=85&s=50c64872e75d3f5475201a42497a4ffb" alt="" width="1830" height="688" data-path="omni/self-hosted/images/configure-keycloak-for-omni-SAML.png" />

* Fill in the **Login settings** as shown in the example below. **Replace the hostname in the example with your own Omni hostname or IP**.
  * Root URL
  * Valid redirect URIs
  * Master SAML Processing URL

<img src="https://mintcdn.com/siderolabs-fe86397c-config-evolution/UyHx5qHlTy4tqJ3A/omni/self-hosted/images/configure-keycloak-for-omni-Root-URL.png?fit=max&auto=format&n=UyHx5qHlTy4tqJ3A&q=85&s=85b947aac4ae017fac04e8d7442b8dba" alt="" width="1790" height="853" data-path="omni/self-hosted/images/configure-keycloak-for-omni-Root-URL.png" />

* Modify the **Signature and Encryption** settings.
  * Sign documents: **off**
  * Sign assertions: **on**

<img src="https://mintcdn.com/siderolabs-fe86397c-config-evolution/UyHx5qHlTy4tqJ3A/omni/self-hosted/images/configure-keycloak-for-omni-signature-encryption.png?fit=max&auto=format&n=UyHx5qHlTy4tqJ3A&q=85&s=fade79a0c923a87cec09349383f926a9" alt="" width="1719" height="856" data-path="omni/self-hosted/images/configure-keycloak-for-omni-signature-encryption.png" />

* Set the **Client signature required** value to **off**.

<img src="https://mintcdn.com/siderolabs-fe86397c-config-evolution/UyHx5qHlTy4tqJ3A/omni/self-hosted/images/configure-keycloak-for-omni-client-signature.png?fit=max&auto=format&n=UyHx5qHlTy4tqJ3A&q=85&s=21140d22c8bf748fd87f087330a06e9b" alt="" width="1718" height="721" data-path="omni/self-hosted/images/configure-keycloak-for-omni-client-signature.png" />

* Modify **Client Scopes**

<img src="https://mintcdn.com/siderolabs-fe86397c-config-evolution/UyHx5qHlTy4tqJ3A/omni/self-hosted/images/configure-keycloak-for-omni-client-scopes.png?fit=max&auto=format&n=UyHx5qHlTy4tqJ3A&q=85&s=d09f3eeb8e9ef31c26927bb57027bb83" alt="" width="1721" height="600" data-path="omni/self-hosted/images/configure-keycloak-for-omni-client-scopes.png" />

* Select **Add predefined mapper**.

<img src="https://mintcdn.com/siderolabs-fe86397c-config-evolution/UyHx5qHlTy4tqJ3A/omni/self-hosted/images/configure-keycloak-for-omni-predefined-mapper.png?fit=max&auto=format&n=UyHx5qHlTy4tqJ3A&q=85&s=b14d0bba80e4163f4e98460cca2a7bed" alt="" width="1723" height="575" data-path="omni/self-hosted/images/configure-keycloak-for-omni-predefined-mapper.png" />

* The following mappers need to be added because Omni will use these attributes for assigning permissions.
  * X500 email
  * X500 givenName
  * X500 surname

<img src="https://mintcdn.com/siderolabs-fe86397c-config-evolution/UyHx5qHlTy4tqJ3A/omni/self-hosted/images/configure-keycloak-for-omni-add-predefined-mappers.png?fit=max&auto=format&n=UyHx5qHlTy4tqJ3A&q=85&s=0ed64c2e7553ff6139cd96cff9988107" alt="" width="1720" height="732" data-path="omni/self-hosted/images/configure-keycloak-for-omni-add-predefined-mappers.png" />

* Add a new user (optional)
  * If Keycloak is being used as an Identity Provider, users can be created here.

<img src="" alt="./images/configure-keycloak-for-omni-create-new-user.png" alt="" />

* Enter the **user information** and set the **Email verified** to **Yes**

<img src="https://mintcdn.com/siderolabs-fe86397c-config-evolution/UyHx5qHlTy4tqJ3A/omni/self-hosted/images/configure-keycloak-for-omni-create-new-user-form.png?fit=max&auto=format&n=UyHx5qHlTy4tqJ3A&q=85&s=96ad4ee0d8558c7c6bbfa430264d4da4" alt="" width="1719" height="608" data-path="omni/self-hosted/images/configure-keycloak-for-omni-create-new-user-form.png" />

* Set a password for the user.

<img src="https://mintcdn.com/siderolabs-fe86397c-config-evolution/UyHx5qHlTy4tqJ3A/omni/self-hosted/images/configure-keycloak-for-omni-no-credentials.png?fit=max&auto=format&n=UyHx5qHlTy4tqJ3A&q=85&s=bd9ee040cfc8e71ca4be516cd16e50a9" alt="" width="1719" height="575" data-path="omni/self-hosted/images/configure-keycloak-for-omni-no-credentials.png" />
