For the complete documentation index, see llms.txt. This page is also available as Markdown.

SAML Integration

Integrate with identity providers such as Azure AD, Okta, and Google Workspace via the SAML 2.0 protocol

SAML (Security Assertion Markup Language) is a standard authentication protocol widely adopted by enterprise-grade applications.

Target audience: Enterprises that have deployed a SAML identity provider (such as Microsoft Entra ID / Azure AD, Okta, Google Workspace)

Key advantages:

  • Industry-standard protocol with high compatibility

  • Identifies users by Email and automatically creates an account on first sign-in (only the Email and display name are read; groups, departments, and other attributes are not)

  • Integrates with multi-factor authentication (MFA)

  • Supports Single Logout (SLO)

Setup Steps

1. Fill in IdP Information in the MaiAgent Backend

After selecting the SAML authentication type, first fill in the Authentication Source Name (used to generate SP endpoint URLs, for example my-company), then provide the IdP settings using one of the following two modes. The two modes cannot be filled in at the same time; the form cannot be saved if both are provided.

Mode
Fields to fill in
When to use

A: Metadata URL

IdP Metadata URL

The IdP provides a publicly readable metadata URL (for example, Microsoft Entra ID). When you save, the system downloads and parses it, automatically obtaining the Entity ID, SSO URL, and certificate; if MaiAgent cannot reach this URL, the form cannot be saved

B: Manual setup

IdP Entity ID, IdP SSO URL, IdP X.509 Certificate (all three fields are required)

The IdP only lets you download a metadata file and has no metadata URL (for example, Google Workspace). For the certificate, paste the base64 content between BEGIN CERTIFICATE and END CERTIFICATE in the PEM

Email Domain is optional: once set, members whose Email uses this domain are automatically redirected to this SAML sign-in when they enter their Email on the sign-in page.

2. Obtain SP (MaiAgent Side) Information

After you fill in the authentication source name, the system automatically generates the following SP information, displayed on the settings page:

SP Field
Format
Description

Entity ID

https://{domain}/accounts/saml/{name}/metadata/

Provided to the IdP for configuration

ACS URL (Assertion Consumer Service URL)

https://{domain}/accounts/saml/{name}/acs/

Provided to the IdP for configuration

Login URL

https://{API domain}/auth/saml/{name}/login/

SAML sign-in entry point

Each of the three values has its own purpose: the Entity ID is the name by which the IdP identifies MaiAgent; the ACS URL (Assertion Consumer Service) is the address to which the IdP sends the signed SAML response after the user signs in successfully at the IdP, and where MaiAgent verifies it and completes the sign-in. The IdP only sends to pre-registered addresses, so paste it exactly as is (including the trailing /); the Login URL is the entry point where users start SSO sign-in and does not need to be entered into the IdP. For technical details, see the Technical Manual SAML SSO Integration.

The SP information area provides a Copy button so you can copy the URLs directly into the IdP's configuration interface.

3. Configure the MaiAgent Application in the Identity Provider (IdP)

Using Microsoft Entra ID (Azure AD) as an example:

  1. Sign in to the Azure Portal > Microsoft Entra ID > Enterprise applications

  2. Click New application > Create your own application

  3. Select "Integrate any other application you don't find in the gallery (Non-gallery)"

Create enterprise application
Create a custom enterprise application in Azure AD
  1. Select the enterprise application you just created

Select enterprise application
Select the specified enterprise application
  1. Open the enterprise application and click Single sign-on > SAML on the left

Select SAML
Select SAML as the single sign-on method
  1. In the Basic SAML Configuration section, enter the MaiAgent SP information:

    • Identifier (Entity ID): Enter the Entity ID generated by MaiAgent

    • Reply URL (Assertion Consumer Service URL): Enter the ACS URL generated by MaiAgent

  2. Save the settings

4. Get the Values from the IdP and Fill Them Back into MaiAgent

At the bottom of the Azure AD Set up Single Sign-On with SAML page, find the following information and, according to the mode in Step 1, fill in one of the sets into the SAML settings form in the MaiAgent backend:

Mode
Azure AD Field
Corresponding MaiAgent Field

A (recommended)

App Federation Metadata Url

IdP Metadata URL

B

Microsoft Entra Identifier

IdP Entity ID

B

Login URL

IdP SSO URL

B

"Certificate (Base64)" downloaded from the SAML Certificates section

IdP X.509 Certificate

When using Mode A, fill in only the IdP Metadata URL and leave the other three fields empty.

IdP information
Obtain the Microsoft Entra Identifier, Login URL, and metadata URL from Azure AD

5. Assign Users and Groups

In the Azure AD enterprise application, click Users and groups > Add user/group, and add the employees or groups that need access to MaiAgent.

Add users and groups
Add the employees or groups that need access to MaiAgent to the enterprise application

6. Save and Confirm

Click the Save button in the MaiAgent backend, and the Confirm Authentication Method Change window appears. Make sure the IdP-side configuration is complete, then click Confirm Change to finish the setup.

SAML Attribute Mapping

MaiAgent reads only two attributes from the SAML response: Email (required, used as the account identifier) and display name. The mapping rules are fixed and cannot be customized in the backend; other attributes such as groups, departments, and job titles are not read, and roles are not synchronized.

  • Email: The default output of Microsoft Entra ID and ADFS works as is; for other IdPs, make sure an Email attribute is sent, or set the NameID format to emailAddress. For the three acceptable Email sources and the order in which they are read, see Section 2.2 "User Attribute Mapping" of the Technical Manual SAML SSO Integration.

  • Display name: Written only on first sign-in, when the account is created; if no display name is sent, the text before the @ in the Email is used instead. Later name changes on the IdP side are not synchronized to MaiAgent.

Other SAML IdP Settings

MaiAgent's SAML integration is not limited to Microsoft Entra ID. Any identity provider that supports the SAML 2.0 standard can be integrated. Common IdPs include:

  • Okta: Add a SAML 2.0 App under Applications

  • Google Workspace: Configure under Admin Console > Security > SSO

  • ADFS: Add under Relying Party Trusts; for full steps, see ADFS Integration

The logic is the same: enter MaiAgent's SP information (Entity ID, ACS URL) into the IdP, then fill the IdP's information back into MaiAgent. If a Metadata URL is available, fill in only the Metadata URL (Mode A); otherwise, fill in the Entity ID, SSO URL, and X.509 certificate (Mode B).

SAML Security Features

  • Supports SAML 2.0 HTTP Redirect Binding

  • Session Index tracking to ensure sign-out operations are correct

  • NameID format uses emailAddress to ensure consistent user identification

  • Sign-in cookie settings: Secure=True, SameSite=None, HttpOnly=True, with a validity of 5 minutes

Settings Quick Reference

Field
Required
Format
Example

Authentication Source Name

Yes

Lowercase letters, digits, and hyphens; max 31 characters

my-company

IdP Metadata URL

Required for Mode A

HTTPS URL

https://login.microsoftonline.com/.../federationmetadata/2007-06/federationmetadata.xml

IdP Entity ID

Required for Mode B

URI

https://sts.windows.net/{tenant-id}/

IdP SSO URL

Required for Mode B

HTTPS URL

https://login.microsoftonline.com/{tenant-id}/saml2

IdP X.509 Certificate

Required for Mode B

Base64 content between BEGIN / END CERTIFICATE in the PEM

MIID...

Email Domain

No

Domain format

company.com

Fill in either Mode A or Mode B; they cannot be provided at the same time.

Last updated

Was this helpful?