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

# SAML SSO

> Authenticate into Tracecat with SAML SSO: configure your identity provider, map attributes, and enable single sign-on for organization-wide access.

## Supported identity providers

* [Okta](#okta)
* [Microsoft Entra ID](#microsoft-entra-id)
* [Authentik](#authentik)
* [Keycloak](#keycloak)

## Configuration

In your `.env` file, make sure you have the following values set.

```bash theme={null}
TRACECAT__AUTH_TYPES=saml
SAML_IDP_METADATA_URL=https://<your-idp-metadata-url>
```

## Access policy

After SAML authentication succeeds, Tracecat allows organization access when at least one of the following is true:

* The user already has membership in the organization.
* The user has a pending invitation for the organization.
* The user is the first-user superadmin bootstrap account in the default organization.
* The user is a platform superadmin (owner).

Tracecat only auto-provisions SAML user accounts for:

* Pending organization invitations.
* First-user superadmin bootstrap (default organization only).

If this is a new deployment, make sure `TRACECAT__AUTH_SUPERADMIN_EMAIL` exactly matches the email claim sent by your IdP for the owner account.

## Instructions

Tracecat always requires signed assertions and signed responses.

<Info>
  If you are using a self-signed certificate for your metadata URL, configure
  a base64-encoded CA certificates `.pem` bundle with `SAML_CA_CERTS` in your
  deployment environment.
</Info>

### Okta

<Steps>
  <Step title="Create an SAML app">
    Go to **Applications** and select **Add Application**.
    Select **SAML 2.0** and click on **Create**.
  </Step>

  <Step title="Configure SAML settings">
    * Set the **Single sign-on URL**, **Recipient URL**, and **Destination URL** to `https://<your-tracecat-instance>/auth/saml/acs`.
    * Set the **Audience Restriction** to `https://<your-tracecat-instance>`.

          <img src="https://mintcdn.com/tracecat/vTdddiMgoOrN3Sue/img/self-hosting/okta-saml.png?fit=max&auto=format&n=vTdddiMgoOrN3Sue&q=85&s=9667ef6ad6abb244aa336c611d9b5e65" alt="Okta SAML" width="1476" height="746" data-path="img/self-hosting/okta-saml.png" />
  </Step>

  <Step title="Configure attribute statements">
    Map `email` to `user.email`

    <img src="https://mintcdn.com/tracecat/vTdddiMgoOrN3Sue/img/self-hosting/okta-saml-attributes.png?fit=max&auto=format&n=vTdddiMgoOrN3Sue&q=85&s=35c88d86352d1ccd7ccc40526bdca31a" alt="Okta attribute statements" width="1476" height="650" data-path="img/self-hosting/okta-saml-attributes.png" />
  </Step>

  <Step title="Configure SAML settings in environment variables">
    Set the following environment variables in your `.env` file:

    * `SAML_IDP_METADATA_URL`: Okta metadata URL
  </Step>

  <Step title="Restart Tracecat instance">
    Restart Tracecat to apply the changes.
  </Step>

  <Step title="Test SSO configuration">
    Navigate to your Tracecat instance and click on the **Login** button.
    You should be redirected to Okta for authentication.
  </Step>
</Steps>

### Microsoft Entra ID

<Info>
  You must enable **Sign SAML response and assertion** in your Microsoft SAML app settings.
  Microsoft SAML apps only sign assertions by default.
</Info>

<Steps>
  <Step title="Create an SAML app">
    Go to **Enterprise applications** and select the **New application** button.
    Find and select the **Microsoft Entra SAML toolkit** app.
  </Step>

  <Step title="Configure SAML settings">
    * Set the **Reply URL** and **Sign on URL** to `https://<your-tracecat-instance>/auth/saml/acs`.
    * Set **Identifier** to `https://<your-tracecat-instance>/api`.
    * Set **Relay State** to `https://<your-tracecat-instance>`.
    * Make sure that **Sign SAML response and assertion** is enabled.

          <img src="https://mintcdn.com/tracecat/vTdddiMgoOrN3Sue/img/self-hosting/entra-saml.png?fit=max&auto=format&n=vTdddiMgoOrN3Sue&q=85&s=d5c4213ba0a4c91ec11ce428cc98535b" alt="Microsoft Entra SAML" width="1536" height="856" data-path="img/self-hosting/entra-saml.png" />
  </Step>

  <Step title="Configure attribute and claims">
    Map `email` to `user.mail`
  </Step>
</Steps>

### Authentik

<Steps>
  <Step title="Create a provider">
    Go to **Providers** and select the **Create** button.
    Choose **SAML Provider** and select the **Next** button.
  </Step>

  <Step title="Configure the provider">
    * Enter a name and choose an authorization flow
    * Set the **ACS URL** to `https://<your-tracecat-instance>/auth/saml/acs`.
    * Set the **Audience** to `https://<your-tracecat-instance>/api`.

          <img src="https://mintcdn.com/tracecat/vTdddiMgoOrN3Sue/img/self-hosting/authentik-provider.png?fit=max&auto=format&n=vTdddiMgoOrN3Sue&q=85&s=1d01bac9cf650c99d67be2d0f793065b" alt="Authentik Provider" width="1507" height="782" data-path="img/self-hosting/authentik-provider.png" />
  </Step>

  <Step title="Configure assertion signing">
    * Expand the **Advanced protocol settings** section.
    * Select a **Signing Certificate** and ensure **Sign assertions** is enabled.

          <img src="https://mintcdn.com/tracecat/9gCSDwoRbHfkqlkK/img/self-hosting/authentik-assertion-signing.png?fit=max&auto=format&n=9gCSDwoRbHfkqlkK&q=85&s=1d86ab96569cc412689f86409206588d" alt="Authentik Provider" width="1445" height="604" data-path="img/self-hosting/authentik-assertion-signing.png" />
  </Step>

  <Step title="Configure property mapping">
    * Select **authentik default SAML Mapping: Name** in **Selected User Property Mappings**.
    * Click the **\<** button to deselect it.
    * Select the **Finish** button.

          <img src="https://mintcdn.com/tracecat/vTdddiMgoOrN3Sue/img/self-hosting/authentik-property-mapping.png?fit=max&auto=format&n=vTdddiMgoOrN3Sue&q=85&s=4762256b866529006e891aba033e1918" alt="Authentik Provider" width="2088" height="642" data-path="img/self-hosting/authentik-property-mapping.png" />
  </Step>

  <Step title="Create an application">
    Go to **Applications** and select the **Create** button.
    Fill in the details as desired.
  </Step>

  <Step title="Find metadata URL">
    * Select the provider you created previously.
    * Select the **Metadata** tab.
    * Select the **Copy download URL** button.
  </Step>

  <Step title="Configure SAML settings in environment variables">
    Set the following environment variables in your `.env` file:

    * `SAML_IDP_METADATA_URL`: Metadata download URL
  </Step>

  <Step title="Restart Tracecat instance">
    Restart Tracecat to apply the changes.
  </Step>

  <Step title="Test SSO configuration">
    Navigate to your Tracecat instance and click on the **Login** button.
    You should be redirected to Authentik for authentication.
  </Step>
</Steps>

### Keycloak

<Steps>
  <Step title="Create a client">
    * Go to **Clients** and select the **Create client** button.
    * Set the **Client type** to **SAML**.
    * Set the **Client ID** to `https://<your-tracecat-instance>/api` and select the **Next** button.

          <img src="https://mintcdn.com/tracecat/vHU_t4NrvCQ5KMzw/img/self-hosting/keycloak-client-general.png?fit=max&auto=format&n=vHU_t4NrvCQ5KMzw&q=85&s=657276440a8fd8749cfe2a7e743d73e5" alt="Keycloak Client General Settings" width="1477" height="583" data-path="img/self-hosting/keycloak-client-general.png" />
  </Step>

  <Step title="Configure a client">
    * Set the **Valid redirect URIs** to `https://<your-tracecat-instance>/auth/saml/acs`.
    * Set the **Master SAML Processing URL** to `https://<your-tracecat-instance>/auth/saml/acs` and select the **Save** button.

          <img src="https://mintcdn.com/tracecat/vHU_t4NrvCQ5KMzw/img/self-hosting/keycloak-client-login.png?fit=max&auto=format&n=vHU_t4NrvCQ5KMzw&q=85&s=c88ce9f3cfb152ca120ed18ff97c8177" alt="Keycloak Client Login Settings" width="1477" height="855" data-path="img/self-hosting/keycloak-client-login.png" />
  </Step>

  <Step title="Configure document signing">
    * In **Settings** tab scroll down to **Signature and Encryption** section.
    * Ensure **Sign documents** is enabled.

          <img src="https://mintcdn.com/tracecat/vHU_t4NrvCQ5KMzw/img/self-hosting/keycloak-document-signing.png?fit=max&auto=format&n=vHU_t4NrvCQ5KMzw&q=85&s=ecca3514de6fe3097767f5d6f43e19a5" alt="Keycloak Document Signing" width="1289" height="624" data-path="img/self-hosting/keycloak-document-signing.png" />
  </Step>

  <Step title="Disable client signing">
    * Open **Keys** tab and look into **Signing keys config** section.
    * Ensure **Client signature required** is disabled.

          <img src="https://mintcdn.com/tracecat/vHU_t4NrvCQ5KMzw/img/self-hosting/keycloak-client-signing.png?fit=max&auto=format&n=vHU_t4NrvCQ5KMzw&q=85&s=77ee47dcc09b0f9e9c0130753a816d8d" alt="Keycloak Client Signing" width="1293" height="624" data-path="img/self-hosting/keycloak-client-signing.png" />
  </Step>

  <Step title="Configure property mapping">
    * Open **Client scopes** tab and click on client scope `https://<your-tracecat-instance>/api-dedicated`.
    * Create new **User Property** mapper for **email** attribute and click **Save**.

          <img src="https://mintcdn.com/tracecat/vHU_t4NrvCQ5KMzw/img/self-hosting/keycloak-email-mapper.png?fit=max&auto=format&n=vHU_t4NrvCQ5KMzw&q=85&s=9cf3d6bbdc91b67227211a1cb3b032e1" alt="Keycloak Property Mapping" width="1293" height="759" data-path="img/self-hosting/keycloak-email-mapper.png" />
  </Step>

  <Step title="Find metadata URL">
    * Go to **Realm Settings** ➤ **General** ➤ **Endpoints**.
    * Copy the **SAML 2.0 Identity Provider Metadata** link.

          <img src="https://mintcdn.com/tracecat/vHU_t4NrvCQ5KMzw/img/self-hosting/keycloak-metadata-url.png?fit=max&auto=format&n=vHU_t4NrvCQ5KMzw&q=85&s=91854f7adc11824c6660ea0f3b96cd7d" alt="Keycloak Property Mapping" width="934" height="188" data-path="img/self-hosting/keycloak-metadata-url.png" />
  </Step>

  <Step title="Configure SAML settings in environment variables">
    Set the following environment variables in your `.env` file:

    * `SAML_IDP_METADATA_URL`: Metadata download URL
  </Step>

  <Step title="Restart Tracecat instance">
    Restart Tracecat to apply the changes.
  </Step>

  <Step title="Test SSO configuration">
    Navigate to your Tracecat instance and click on the **Login** button.
    You should be redirected to Keycloak for authentication.
  </Step>
</Steps>

## Environment variables

For standard self-hosted SAML setup, provide your IdP metadata URL in the
deployment environment.

### Protocol configuration

* `SAML_ALLOW_UNSOLICITED`: Whether to allow unsolicited SAML responses (default: `false`)
* `SAML_ACCEPTED_TIME_DIFF`: Time difference in seconds for SAML authentication (default: `3`)

Tracecat always requires signed assertions and signed responses. These checks are
not configurable.

### SSL transport configuration

* `SAML_VERIFY_SSL_ENTITY`: Whether to verify SSL certificates for general SAML entity operations (default: `true`)
* `SAML_VERIFY_SSL_METADATA`: Whether to verify SSL certificates when fetching metadata (default: `true`)
* `SAML_CA_CERTS`: Base64 encoded CA certificates for SSL/TLS transport layer validation
