[Yandex Cloud documentation](../../../index.md) > [Yandex Identity Hub](../../index.md) > [Tutorials](../index.md) > [Setting up single sign-on (SSO) for apps](index.md) > MTS Link

# Creating a SAML app in Yandex Identity Hub for integration with MTS Link


[MTS Link](https://mts-link.ru/) is a platform for online meetings, webinars, and learning. You can set up SAML-based single sing-on to MTS Link with Yandex Identity Hub as the identity provider (IdP) and MTS Link as the service provider (SP).

To enable your [organization’s](*organization) users to authenticate in MTS Link using Yandex Identity Hub:

1. [Getting started](#before-you-begin).
1. [Create a SAML application](#create-app).
1. [Configure the IdP in MTS Link](#setup-sp).
1. [Set up your application in Yandex Identity Hub](#setup-idp).
1. [Add users to the application](#add-users).
1. [Verify your domain and enable SSO in MTS Link](#enable-sso).
1. [Test single sign-on](#validate).

## Getting started {#before-you-begin}

To configure this integration, you will need:

* Organization in Yandex Identity Hub. If you do not have an organization yet, [create one](../../operations/enable-org.md).
* Account with access to the organization's SSO settings in MTS Link.
* Corporate email domain you can verify in MTS Link.
* Test user in Yandex Identity Hub with an email address under this domain. If you do not have a suitable user, [add one](../../operations/add-account.md). Check that the user's profile specifies an email address and their full name.

SAML apps can be managed by users with the `organization-manager.samlApplications.admin` [role](../../security/index.md#organization-manager-samlApplications-admin) or higher.

## Create a SAML application {#create-app}

{% list tabs group=instructions %}

- Cloud Center UI {#cloud-center}

    1. Log in to [Yandex Identity Hub](https://center.yandex.cloud/organization) and select your organization.
    1. In the left-hand panel, select ![shapes-4](../../../_assets/console-icons/shapes-4.svg) **Apps**.
    1. Click ![circles-3-plus](../../../_assets/console-icons/circles-3-plus.svg) **Create application**.
    1. Select the **SAML (Security Assertion Markup Language)** single sign-on method.
    1. In the **Name** field, enter the application name: `mts-link-saml`.
    1. Click **Create application**.
    1. On the application page, navigate to the **Identity provider (IdP) configuration** section and copy the following field values:

        * **Issuer / IdP EntityID**
        * **Login URL**
        * **Logout URL**

    1. Under **Application certificate**, click **Download certificate**.

{% endlist %}

You will need the values and certificate file you saved to configure the IdP in MTS Link.

## Configure the IdP in MTS Link {#setup-sp}

1. Log in to MTS Link using an account with access to your organization's SSO settings.
1. Navigate to the **SSO settings** section in your MTS Link organization’s settings. If your organization is hosted on a dedicated subdomain, go to `https://<organization_subdomain>.mts-link.ru/business/sso-settings`. Otherwise, navigate to `https://my.mts-link.ru/business/sso-settings`.
1. Under **Protocol and IdP settings**, select the following values:

    * **Protocol**: **SAML**.
    * **SSO provider**: **Active Directory**. This option is used for setting up the integration with Yandex Identity Hub.

1. Fill in the fields using the values you saved when [creating the SAML application](#create-app):

    #|
    || **MTS Link field** | **Value from Yandex Identity Hub** ||
    || Identity Provider (IdP) Entity ID | Issuer / IdP EntityID ||
    || Sign-in page URL | Login URL ||
    || Sign-out page URL | Logout URL ||
    || Identity provider certificate | Full payload of the downloaded certificate file, including `-----BEGIN CERTIFICATE-----` and `-----END CERTIFICATE-----`.  ||
    |#

1. Save the settings. The **Enter this data into your SSO provider** section will show the MTS Link settings. Copy and save these values:

    * **Entity ID**
    * **URL ACS**
    * **URL SLS**

Make sure to copy the full values, including all URL parameters. You will need them in the next step.

## Set up your application in Yandex Identity Hub {#setup-idp}

### Specify the IdP settings {#setup-sp-settings}

{% list tabs group=instructions %}

- Cloud Center UI {#cloud-center}

    1. In [Yandex Identity Hub](https://center.yandex.cloud/organization), navigate to **Apps** and select the `mts-link-saml` application.
    1. At the top right, click ![pencil](../../../_assets/console-icons/pencil.svg) **Edit**.
    1. In the **Service provider (SP) configuration** section, enter the values you copied from MTS Link:

        #|
        || **Yandex Identity Hub field** | **MTS Link value** ||
        || SP EntityID  | Entity ID ||
        || ACS URL | URL ACS ||
        || SP Logout URL | URL SLS ||
        |#

    1. In the **Signature mode** field, select **Assertions and Response**.

        {% note warning %}

        For integration with MTS Link, you must sign both the SAML response and its nested assertions. Make sure to use the **Assertions and Response** mode.

        {% endnote %}

    1. Leave the **Only accept signed requests** and **Encrypt assertion in response** options disabled for this specific integration.
    1. Click **Save**.

{% endlist %}

### Configure user attributes {#setup-attributes}

MTS Link retrieves user data from [SAML attributes](../../concepts/applications/saml.md#saml-attributes). Configure them in your application:

{% list tabs group=instructions %}

- Cloud Center UI {#cloud-center}

    1. On the `mts-link-saml` application page, switch to the **Attributes** tab.
    1. Edit the attributes as follows:

        #|
        || **Attribute** | **Value** ||
        || `NameID` (required) | `SubjectClaims.preferred_username` ||
        || `fullname` | `SubjectClaims.name` ||
        || `emailAddress` | `SubjectClaims.email` ||
        || `firstName` | `SubjectClaims.given_name` ||
        || `secondName` | `SubjectClaims.family_name` ||
        |#

        To edit an existing attribute, click the attribute row, specify the name and value from the table, and click **Update**. Do not change the name of the required `NameID` attribute.

        To add a missing attribute, click **Add attribute**, fill out the **Attribute name** and **Value** fields, and click **Add**.

{% endlist %}

Attribute names are case-sensitive. If the application already has the `emailaddress` attribute, rename it to `emailAddress`. Note that `secondName` must indicate the user's last name, not their middle name.

## Add users to the application {#add-users}

To allow users to log in to MTS Link, you must explicitly add them or their respective [groups](../../concepts/groups.md) to the SAML application.

{% note info %}

Users and groups added to a SAML application can be managed by a user with the `organization-manager.samlApplications.userAdmin` [role](../../security/index.md#organization-manager-samlApplications-userAdmin) or higher.

{% endnote %}

{% list tabs group=instructions %}

- Cloud Center UI {#cloud-center}

    1. On the `mts-link-saml` application page, navigate to the **Users and groups** tab.
    1. Click ![person-plus](../../../_assets/console-icons/person-plus.svg) **Add users**.
    1. Select the users or groups. Add a test user for the testing step.
    1. Click **Add**.

{% endlist %}

## Verify your domain and enable SSO in MTS Link {#enable-sso}

1. Go back to the **SSO settings** section in MTS Link. On the page with the IdP settings, click **Next**.
1. In the **Specify email domain** section, enter your corporate user email domain and click **Add**.
1. Verify the domain by following the MTS Link instructions. Make sure the domain status has changed to **Verified**.
1. Enable the **Use SSO for account login** option.

    When an employee logs in via SSO for the very first time, MTS Link will automatically create their profile, add them to your organization, and assign them to your company's active service plan

1. Optionally, enable additional restrictions:

    * **Register users with verified domains of my organization only via SSO**: Ensures that users with these domains can only register via single sign-on.
    * **Use SSO to restrict access to courses and webinars for all organization accounts**: Enforces SSO access to all your organization’s courses and webinars.

    {% note tip %}

    Enable these optional restrictions only after [testing the SSO](#validate) with your test user so that configuration errors do not disrupt your team’s work.

    {% endnote %}

## Test single sign-on {#validate}

1. In your browser, go to the MTS Link login page at `https://my.mts-link.ru/` or to your organization's subdomain page. If already logged in to MTS Link, sign out of your account.
1. Enter the email address of the test user account with the verified domain.
1. Check that MTS Link redirects you to the Yandex Identity Hub authentication page.
1. Log in using the test user account you added to the SAML app.
1. Confirm that after authentication, you are redirected back to MTS Link and have access to an account within your organization. Check that the first name, last name, and email address are correct.

If SSO fails, double-check that:

* Your email domain is verified in MTS Link, and SSO is enabled.
* The user or the user’s group is added to the SAML app.
* Service provider and IdP settings were copied correctly, and the certificate matches the application.
* The **Assertions and Response** mode is used.
* All attribute names and values match the [table](#setup-attributes) values, and the user's profile specifies an email address.

#### Useful links {#see-also}

* [SAML apps](../../concepts/applications/saml.md)
* [Updating a SAML app in Yandex Identity Hub](../../operations/applications/saml-update.md)
* [Azure AD SSO setup guide on the MTS Link website](https://help.mts-link.ru/article/19520)

[*organization]: An _organization_ is the highest resource in the Yandex Cloud resource model hierarchy that consolidates the resources of all other services. It is also used for user management as well as authentication and authorization management. For more information, see [Organization](../../concepts/organization.md).