# Keycloak

Use these instructions to set up Keycloak as your SSO provider for Tonic Textual.

## Keycloak configuration

Within Keycloa&#x6B;**,** select the realm to use for your Textual client. Under **Clients**, click **Create client**.

<figure><img src="/files/2QEtyz0WD2yAYvaqviHa" alt=""><figcaption><p>Create client option for Keycloak</p></figcaption></figure>

On the **Create client** page, under **General Settings**:

1. From the **Client type** dropdown list, select **OpenID Connect**.
2. Enter a **Client ID** and **Name**.
3. Click **Next**.

<figure><img src="/files/EjhH8lWkmC3vRxZ0MVEi" alt=""><figcaption><p>Create client fields for a Keycloak client</p></figcaption></figure>

On the **Capability Config** tab, click **Save**. The details page for the new client displays.

On the **Settings** tab, under **Access settings**, enter your Textual URL information.

<figure><img src="/files/ofbR6l7zDLRbQPY20nwm" alt=""><figcaption><p>Access settings for a Keycloak client</p></figcaption></figure>

Click **Client scopes**. Each client has a dedicated scope named `<client-id>-dedicated`. To configure the scope, click the scope name.

<figure><img src="/files/qRtla2jOuoi0PneWEXWW" alt=""><figcaption><p>Client scopes tab for a Keycloak client</p></figcaption></figure>

On the **Mappers** tab, to add a property mapper to the scope, click **Configure a new mapper**.

<figure><img src="/files/vQSgwX9ApofEc1Ol7NW4" alt=""><figcaption><p>Options to add a property mapper to a Keycloak client scope</p></figcaption></figure>

In the list of mapper types, click **Group Membership**.

<figure><img src="/files/lxdbMT5WnHtvhmHRQeZp" alt=""><figcaption><p>Available mapper types for a Keycloak client scope property mapper</p></figcaption></figure>

Under **Add mapper**, set both **Name** and **Token Claim Name** to `groups`.

<figure><img src="/files/C68ABxGwFm0DwFaSIdic" alt=""><figcaption><p>Configuration options for a Keycloak property mapper</p></figcaption></figure>

The **Full group path** toggle affects how child groups appear in Tonic:

* When on, child groups display as `parent group/child group`.
* When off, child groups display as `child group`.

To save the new group membership mapper, click **Save**.

## Textual configuration <a href="#keycloak-textual-configuration" id="keycloak-textual-configuration"></a>

After you complete the configuration in Keycloak, you uncomment and configure the required [environment variables](/textual/textual-install-administer/configuring-textual/textual-env-var-configure.md) in Textual.

* The realm URL
* The client identifier
* The client secret, if client authentication is enabled

For Kubernetes, in **values.yaml**:

```
# Keycloak SSO Config
# -----------------
#keycloakClientId: <client-id>
#keycloakClientSecret: <client-secret>
#keycloakAuthority: <authority-url>
#keycloakGroupFilterRegex: <regular expression to identify allowed groups>
```

For Docker, in **.env**:

<pre><code>#SOLAR_SSO_KEYCLOAK_AUTHORITY=#&#x3C;keycloak_url_with_scheme>/realms/&#x3C;realm_name>
#SOLAR_SSO_KEYCLOAK_CLIENT_ID=#&#x3C;client identifier>
<strong>#SOLAR_SSO_KEYCLOAK_CLIENT_SECRET=#&#x3C;client secret>
</strong>#SOLAR_SSO_KEYCLOAK_GROUP_FILTER_REGEX=#&#x3C;regex to identify allowed groups>
</code></pre>

## Disabling pushed authorization requests

The environment variable `SOLAR_SSO_KEYCLOAK_DISABLE_PUSHED_AUTHORIZATION` determines whether to disable Keycloak pushed authorization requests.

By default, this is `false`.

You would set this to `true` to troubleshoot Keycloak authentication issues.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tonic.ai/textual/textual-install-administer/user-access-textual/textual-sso/keycloak.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
