> For the complete documentation index, see [llms.txt](https://docs.tonic.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tonic.ai/app/admin/tonic-user-access/single-sign-on/saml.md).

# SAML

Use these instructions to set up a SAML SSO provider for Tonic Structural.

## SAML provider configuration

You must configure the following assertions to be sent to Structural from your SAML provider:

* `Email`
* `GivenName`
* `FamilyName`
* `Groups`

For the Assertion Consumer Service (ACS) URL:

* On a self-hosted instance, the value is `https://your-tonic-url/api/sso/samllogin`.
* On Structural Cloud, the value is `https://app.tonic.ai/api/sso/samllogin/<your organization identifier>`. Your organization identifier is displayed on your [**User Settings** view](/app/managing-your-tonic-account.md#user-view-copy-org-id).

Set `Audience` to the value of the Structural environment setting `TONIC_SSO_SAML_ENTITY_ID`.

## Structural configuration - self-hosted

On a self-hosted instance of Structural, in the Structural web server container, set the following [Structural environment settings](/app/admin/environment-variables-setting.md):

* `TONIC_SSO_PROVIDER`: `SAML`
* `TONIC_SSO_SAML_IDP_METADATA_XML_URL`- Set to the URL of your IDP Metadata XML file.\
  \
  If your SSO solution does not offer a URL, you can set `TONIC_SSO_SAML_IDP_METADATA_XML_BASE64` to the Base 64 encoded contents of the IDP Metadata XML file.\
  \
  To encode the contents, run the following command:\
  \
  `cat /path/to/xml/file | base64 -w 0`
* `TONIC_SSO_SAML_ENTITY_ID`: The entity ID to use to send SAML requests from Structural. If this is not set, the entity ID is determined from the IDP metadata. You also use this as the value of **Audience** in the SAML provider configuration.
* `TONIC_SSO_GROUP_FILTER_REGEX`: Identifies the allowed SSO groups for Structural. For details, go to [Synchronizing SSO groups with Structural](/app/admin/tonic-user-access/single-sign-on/sso-limit-groups.md).

## Structural configuration - Structural Cloud

On Structural Cloud, after you [enable SSO](/app/admin/tonic-user-access/single-sign-on/sso-cloud.md#enabling-sso), to configure the connection to SAML:

<figure><img src="/files/iPIO0u5NUhjwCUSPM51C" alt=""><figcaption></figcaption></figure>

1. Click **SAML 2.0**.
2. In the **IDP Metadata** field, provide either:
   * The URL of your IDP Metadata XML file.
   * If your SSO solution does not offer a URL, the Base 64 encoded contents of the IDP Metadata XML file.
3. In the **Entity ID** field, provide the entity ID to use to send SAML requests from Structural. If this is not set, the entity ID is determined from the IDP metadata. This can also be the value of Audience in the SAML provider configuration.
4. Optionally, to enable cross-origin resource sharing (CORS), in the **IDP Origin** field, provide the origin URL of your identity provider.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.tonic.ai/app/admin/tonic-user-access/single-sign-on/saml.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
