> For the complete documentation index, see [llms.txt](https://docs.aquilax.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.aquilax.ai/user-manual/single-sign-on-saml.md). Agents can also search and read this documentation through its [MCP server](https://docs.aquilax.ai/~gitbook/mcp).

# Single Sign-On (SAML)

## Single Sign-On (SAML)

With single sign-on (SSO), people sign in to AquilaX with the account they already use at work. AquilaX connects to your identity provider over **SAML 2.0**, so it works with:

* Microsoft 365 / Microsoft Entra ID (Azure AD)
* Okta
* Google Workspace
* Microsoft ADFS
* any other SAML 2.0 identity provider

Single sign-on is set up per organization, by an **Owner**. It is available on every plan for **on-premises** installations, and on the **Ultimate** plan in the AquilaX cloud.

### Before you start

* You are an **Owner** of the AquilaX organization.
* You can create an application (often called an "enterprise application" or "app integration") in your identity provider.
* **On-premises:** AquilaX is reachable at an `https://` address with a trusted certificate, for example `https://aquilax.yourcompany.com`. See On-premises notes.

### Overview

| Step | Where             | What                              |
| ---- | ----------------- | --------------------------------- |
| 1    | AquilaX           | Copy the AquilaX details          |
| 2    | Identity provider | Create the AquilaX application    |
| 3    | AquilaX           | Connect your identity provider    |
| 4    | AquilaX           | Add your email domains            |
| 5    | AquilaX           | Choose what happens to new people |
| 6    | AquilaX           | Test, then turn on                |

In AquilaX, everything is on **Organizations → your organization → Single sign-on (SAML)**.

### Step 1: Copy the AquilaX details

Under **1. Add AquilaX to your identity provider**, AquilaX shows the values your identity provider needs. Each has a copy button:

| AquilaX field        | Called in your identity provider                            | Looks like                                            |
| -------------------- | ----------------------------------------------------------- | ----------------------------------------------------- |
| **Entity ID**        | Identifier, Audience URI, SP Entity ID                      | `https://<your-aquilax>/api/v2/sso/<org-id>`          |
| **Reply URL**        | ACS URL, Assertion Consumer Service URL, Single sign-on URL | `https://<your-aquilax>/api/v2/sso/<org-id>/acs`      |
| **AquilaX metadata** | Service provider metadata                                   | `https://<your-aquilax>/api/v2/sso/<org-id>/metadata` |

`<org-id>` is your organization's ID. Copy the values from the page rather than typing them: they must match exactly.

### Step 2: Create the AquilaX application in your identity provider

AquilaX needs the person's **email address** in every sign-in. It reads it from the usual email claims (`email`, `mail`, `emailaddress`, `http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress`), or from the Name ID when that is an email address. First name, last name and display name are used when they are sent.

#### Microsoft 365 / Microsoft Entra ID

1. In the [Microsoft Entra admin center](https://entra.microsoft.com), open **Enterprise applications → New application → Create your own application**.
2. Name it **AquilaX**, choose **Integrate any other application you don't find in the gallery (Non-gallery)** and click **Create**.
3. Open **Single sign-on** and choose **SAML**.
4. In **Basic SAML Configuration**, click **Edit** and set:

   * **Identifier (Entity ID):** the AquilaX **Entity ID**
   * **Reply URL (Assertion Consumer Service URL):** the AquilaX **Reply URL**
   * **Sign on URL:** the AquilaX **Sign-in link** shown in step 6 (optional; it lets people open AquilaX from the Microsoft My Apps portal)

   Click **Save**.
5. **Attributes & Claims:** the defaults work. AquilaX reads `emailaddress` (`user.mail`), `givenname`, `surname` and `name`. If your users have no mailbox and `user.mail` is empty, change the `emailaddress` claim to `user.userprincipalname`.
6. **Users and groups:** add the users or groups who may use AquilaX.
7. Under **SAML Certificates**, copy the **App Federation Metadata Url**. You need it in step 3.

#### Okta

1. In the Okta Admin Console, open **Applications → Applications → Create App Integration**, choose **SAML 2.0** and click **Next**.
2. Name it **AquilaX** and click **Next**.
3. In **Configure SAML** set:
   * **Single sign-on URL:** the AquilaX **Reply URL** (keep **Use this for Recipient URL and Destination URL** ticked)
   * **Audience URI (SP Entity ID):** the AquilaX **Entity ID**
   * **Name ID format:** EmailAddress
   * **Application username:** Email
4. Under **Attribute Statements**, add:

   | Name        | Value            |
   | ----------- | ---------------- |
   | `email`     | `user.email`     |
   | `firstName` | `user.firstName` |
   | `lastName`  | `user.lastName`  |
5. Finish the wizard, then on the **Assignments** tab assign the people or groups who may use AquilaX.
6. On the **Sign On** tab, copy the **Metadata URL**. You need it in step 3.

#### Google Workspace

1. In the [Google Admin console](https://admin.google.com), open **Apps → Web and mobile apps → Add app → Add custom SAML app**.
2. Name it **AquilaX** and click **Continue**.
3. Under **Option 1**, click **Download metadata** and keep the file: you upload it in step 3. Click **Continue**.
4. In **Service provider details** set:
   * **ACS URL:** the AquilaX **Reply URL**
   * **Entity ID:** the AquilaX **Entity ID**
   * **Name ID format:** EMAIL
   * **Name ID:** Basic Information › Primary email
5. Optionally, under **Attribute mapping**, map **First name** to `firstName` and **Last name** to `lastName`. Click **Finish**.
6. Open the app's **User access** and turn it **ON** for everyone, or for the organizational units that should use AquilaX.

#### Microsoft ADFS

1. In **AD FS Management**, open **Relying Party Trusts → Add Relying Party Trust**, choose **Claims aware**.
2. Choose **Import data about the relying party published online or on a local network** and enter the **AquilaX metadata** URL. If the ADFS server can't reach AquilaX, save that URL as a file from your browser and import the file instead.
3. Name it **AquilaX**, choose an access control policy and finish the wizard.
4. Edit the **Claim Issuance Policy** and add two rules:
   * **Send LDAP Attributes as Claims** (attribute store: Active Directory): `E-Mail-Addresses` → **E-Mail Address**, `Given-Name` → **Given Name**, `Surname` → **Surname**.
   * **Transform an Incoming Claim**: **E-Mail Address** → **Name ID**, format **Email**.
5. Your ADFS metadata URL is `https://<your-adfs-host>/FederationMetadata/2007-06/FederationMetadata.xml`. You need it in step 3.

#### Other SAML 2.0 identity providers

Create a SAML application with the AquilaX **Entity ID** and **Reply URL**, and send the email address as an attribute or as the Name ID. AquilaX starts every sign-in itself (SP-initiated) over the HTTP-Redirect binding, and needs signed responses or assertions.

### Step 3: Connect your identity provider

Under **2. Connect your identity provider**, either:

* paste the identity provider's **metadata URL** and save, or
* next to **No URL?**, click **Upload metadata XML** and choose the metadata file (up to 1 MB).

AquilaX shows the identity provider's entity ID when the metadata is accepted. With a metadata URL, AquilaX re-reads it once a day, so a renewed signing certificate is picked up on its own. With an uploaded file, upload the new file when the certificate changes.

Connecting a different identity provider later turns single sign-on off until a new test sign-in passes.

### Step 4: Add your email domains

Under **3. Company email domains**, add each email domain your people sign in with, for example `yourcompany.com`. Only people whose email is in one of these domains can sign in through this connection. Public email providers such as gmail.com or outlook.com can't be added.

* **On-premises:** domains are verified as soon as you add them.
* **AquilaX cloud:** prove each domain is yours with the DNS TXT record AquilaX shows (name `_aquilax-verification.<domain>`), then click **Verify**. DNS changes can take a few minutes.

### Step 5: Choose what happens to new people

Under **4. New people**:

* **Add people from these domains automatically** (on by default): anyone from your domains who signs in with SSO joins the organization and uses a free seat. Turn it off to let in only people who were already invited.
* **Role for people who join this way:** Viewer (default), Developer or Security Manager. Owners can change anyone's role later under **Users and Permissions**.

People an Owner removed from the organization are not added back automatically: invite them again.

### Step 6: Test, then turn on

1. Under **5. Test, then turn on**, click **Run a test sign-in**. It opens in a new tab: sign in with your company account, and AquilaX confirms **Test sign-in worked**.
2. Back on the settings page, refresh: it shows **Test passed for** your email address.
3. Turn on **Company sign-in**.

AquilaX then shows the **Sign-in link** for the organization. You can share it, or use it as the Sign on URL in your identity provider's app portal.

### How people sign in

1. On the AquilaX sign-in page, click **Continue with company SSO**.
2. Enter your work email and continue.
3. Sign in at your identity provider. You come back to AquilaX, signed in to your organization.

SSO sessions last **12 hours**; after that people sign in again. Sign-in always starts from AquilaX (the sign-in page or the sign-in link): opening AquilaX directly from an identity provider tile works when the tile points at the AquilaX sign-in link.

### On-premises notes

* **Address:** AquilaX builds the Entity ID, Reply URL and metadata URL from its public address: the part of `CALLBACK_URI` before `/callback` in the AquilaX environment settings (or `LOGIN_CALLBACK_BASE_URL` when set). It must be the `https://` address people use in their browser. If you change it later, copy the new values from step 1 into your identity provider.
* **Certificate:** use a host name with a certificate your users' browsers trust. Identity providers such as Microsoft Entra ID require an `https://` Reply URL.
* **Network:** sign-in runs through the user's browser, so your identity provider doesn't need to reach the AquilaX server. The AquilaX server only downloads the identity provider's metadata URL; that URL may be on your internal network, but must be `https://`. Without that access (for example in an isolated network), upload the metadata XML instead.
* **Plans and domains:** single sign-on is available on every plan on-premises, and domains don't need DNS verification.

### Troubleshooting

| Message or symptom                                                   | What to check                                                                                                                            |
| -------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| Microsoft: `AADSTS50011` (reply URL mismatch)                        | The **Reply URL** in Entra ID must match the AquilaX **Reply URL** exactly.                                                              |
| *Your company sign-in did not include an email address*              | Send the email claim (Entra ID: `emailaddress`; Okta: `email` attribute or EmailAddress Name ID; Google: Name ID = Primary email).       |
| *…is not in a domain covered by this organization's company sign-in* | Add that email domain in step 4. With Entra ID, check whether the email is a `…onmicrosoft.com` address rather than your company domain. |
| *You are not a member of … Ask an Owner to invite you.*              | **Add people automatically** is off: invite the person, or turn it on.                                                                   |
| *… has no free seats*                                                | Add seats, or remove people who no longer need access.                                                                                   |
| *Your access to … was removed*                                       | An Owner removed this person: invite them again.                                                                                         |
| *This sign-in link has expired or was already used*                  | The sign-in took more than 10 minutes, or the page was refreshed. Start again from the sign-in page.                                     |
| *Could not download the metadata URL*                                | The URL must be `https://` and reachable from the AquilaX server. Otherwise upload the metadata XML.                                     |
| *The metadata is not usable*                                         | Use the identity provider's SAML metadata (it must offer sign-in over HTTP-Redirect and include a signing certificate).                  |
| *Company sign-in is not turned on for this organization*             | Finish step 6.                                                                                                                           |

Need help? Contact us at <support@aquilax.ai>.
