import SsoSamlSpMetadata from '@/mdx-components/SsoSamlSpMetadata';
import Step from '@/mdx-components/Step';

<Step index={0} title="Create a SAML SSO application on your IdP" >

Initiate the SAML SSO integration by creating an application on the IdP side. Obtain the following configurations from Logto, representing your Service Provider (SP):

- **Audience URI(SP Entity ID)**: It represents as a globally unique identifier for your Logto service, functioning as the EntityId for SP during authentication requests to the IdP. This identifier is pivotal for the secure exchange of SAML assertions and other authentication-related data between the IdP and Logto.

- **ACS URL**: The Assertion Consumer Service (ACS) URL is the location where the SAML assertion is sent with a POST request. This URL is used by the IdP to send the SAML assertion to Logto. It acts as a callback URL where Logto expects to receive and consume the SAML response containing the user's identity information.

<SsoSamlSpMetadata />

Fill in the above configurations in your IdP SAML application and continue to retrieve the following configurations from your IdP.

</Step>

<Step index={1} title="Configure SAML SSO on Logto">

To make the SAML SSO integration work, you will need to provide the IdP metadata to Logto. The IdP metadata is an XML document that contains all the information required for Logto to establish the trust with the IdP.

Navigate to the `Connection` tab. Logto provides three different ways to configure the IdP metadata:

1. **Metadata URL**: Provide the URL of the IdP metadata XML document. Logto will fetch the metadata from the URL and configure the SAML SSO integration automatically.

2. **Upload Metadata**: Upload the IdP metadata XML document. Logto will parse the XML document and configure the SAML SSO integration automatically.

3. **Manual Configuration**: Manually configure the IdP metadata.

- IdP entity ID: The Entity ID of the IdP.
- Single sign-on URL: The URL of the IdP Single Sign-On Service.
- Signing certificate: The x509 certificate used to verify the signature of the SAML response from the IdP.

With either of the above configurations, Logto will parse the IdP metadata and configure the SAML SSO integration accordingly.

</Step>

<Step index={2} title="Configure user attributes mapping">

The user attributes returned from IdP may vary depending on the IdP configuration. Logto provides a flexible way to map the user attributes returned from IdP to the user attributes in Logto. You can configure the user attributes mapping in the SAML SSO integration experience tab.

- id: The unique identifier of the user. Logto will read the `nameId` claim from the SAML response as the user SSO identity id.

- email: The email address of the user.

- name: The name of the user.

</Step>

<Step index={3} title="Set email domains and enable the SSO connector">

Provide the email `domains` of your organization in the SAML SSO integration `experience` tab. This will enable the SSO connector as an authentication method for those users.

Users with email addresses in the specified domains will be exclusively limited to use SAML SSO connector as their only authentication method.

</Step>
