Creating a SAML app in Yandex Identity Hub for integration with Managed Service for GitLab
Note
This feature is at the Preview stage.
To authenticate your organization's users to Yandex Managed Service for GitLab via SAML
SAML apps can be managed by users with the organization-manager.samlApplications.admin role or higher.
For the users of your organization to be able to access Managed Service for GitLab:
- Create a GitLab instance.
- Create an app in Identity Hub.
- Set up the integration.
- Make sure the application works correctly.
Create a GitLab instance
-
In the management console, select the folder where you want to create a GitLab instance.
-
Select Managed Service for GitLab.
-
Click Create instance.
-
At the top of the page:
- Enter the instance name. It must be unique throughout Yandex Cloud.
-
Under Configuration:
-
Select the instance type. After you create an instance, you can change its type to a higher performing one.
-
Specify the availability zone. After you create an instance, you cannot change its availability zone.
-
Specify the subnet where the instance will be hosted.
-
Select a security group or create a new one:
- Click Create group.
- Enter a name and description for the security group. You can add rules for the security group later in Virtual Private Cloud.
- Click Create.
-
Select the disk size. After you create an instance, you can increase its disk size.
-
Specify the instance domain name: relevant DNS records will be automatically created for it in the
.gitlab.yandexcloud.netdomain. -
Set up the retention period for automatic backups (in days).
-
-
Under Administrator data, specify:
- Email: Email address of the GitLab instance administrator. This is the address to receive the email with a link to create a password.
- Login: Administrator login.
-
Click Create.
-
Wait for the instance to get ready: its status on the Managed Service for GitLab dashboard will change to Running. This may take some time.
Create an app in Identity Hub
- Log in to Yandex Identity Hub
. - In the left-hand panel, select
Apps. - In the top-right corner, click
Create application and in the window that opens:-
Select the SAML (Security Assertion Markup Language) single sign-on method.
-
In the Name field, specify a name for your new app:
managed-gitlab-app. -
Optionally, in the Description field, enter a description for the new app.
-
Optionally, add labels:
- Click Add label.
- Enter a label in
key: valueformat. - Press Enter.
-
Click Create application.
-
- Save the Login URL, Issuer / IdP EntityID and Fingerprint values as you will need them in the next step.
Set up the integration
Set up GitLab authentication using OmniAuth
To enable GitLab authentication using OmniAuth, add an authentication provider:
-
In the management console
, go to the folder dashboard and select Managed Service for GitLab. -
Click the instance you created and select the OmniAuth tab.
-
Click Configure.
-
To add an authentication provider, click Add.
-
Select
SAMLfor the type and configure the provider as follows:- Label: Name of the authentication provider. Specify any name, e.g.,
Identity Hub. - Assertion consumer service URL: HTTPS endpoint of the GitLab instance. To create this URL, add
/users/auth/saml/callbackto your GitLab instance URL, such ashttps://example.gitlab.yandexcloud.net/users/auth/saml/callback. - IDP certificate fingerprint: SHA1 fingerprint of a public certificate key. Use the Fingerprint field value you got when creating the app in Identity Hub.
- IDP SSO target URL: URL of the IdP. Use the Login URL field value.
- Issuer: Unique ID of the application where user authentication will be performed, such as
https://example.gitlab.yandexcloud.net. - Name identifier format: Name ID format. Set it to
Persistent. - Allow single sign on: Allow using SSO. Set the
truevalue. If set tofalse, only users who already have a GitLab account will be able to authenticate. - Auto link users by email: Map the username in OmniAuth to that in GitLab if they have the same email address linked. Set the
truevalue. - Block auto-created users: Automatically switch the created accounts to Pending approval
until they get approved by an administrator. Set thefalsevalue. - External provider: Set the external attribute for the provider. Users authenticated through this provider will be treated as external
and will have no access to internal projects . Set thefalsevalue. - Auto link LDAP user: Create an LDAP entity for automatically created accounts. This parameter only applies to instances with an LDAP provider connected. Set the
falsevalue.
- Label: Name of the authentication provider. Specify any name, e.g.,
-
Click Create.
Set up the SAML application in Yandex Identity Hub
Set up service provider endpoints
- Log in to Yandex Identity Hub
. - In the left-hand panel, select
Apps and then, the SAML app. - At the top right, click
Edit and in the window that opens:- In the SP EntityID field, provide the endpoint URL you specified under Issuer when setting up OmniAuth.
- In the ACS URL field, provide the endpoint URL you specified under Assertion consumer service URL when setting up OmniAuth, e.g.,
https://example.gitlab.yandexcloud.net/users/auth/saml/callback. - Click Save.
Configure user attributes
Warning
For integration with GitLab, users must have the email attribute.
-
Log in to Yandex Identity Hub
. -
In the left-hand panel, select
Apps and select the desired app. -
Navigate to the Attributes tab.
-
Click the
emailaddressattribute and do the following in the window that opens:- Change the Attribute name field value to
email. - Click Update.
- Change the Attribute name field value to
For more information about configuring attributes, see Configure user and group attributes.
Add a user
For your organization's users to be able to authenticate in GitLab with Identity Hub's SAML app, you need to explicitly add these users and/or user groups to the SAML application.
Note
Users and groups added to a SAML application can be managed by a user with the organization-manager.samlApplications.userAdmin role or higher.
-
Add users to the application:
Cloud Center UI- Log in to Yandex Identity Hub
. - In the left-hand panel, select
Apps and select the required app. - Navigate to the Users and groups tab.
- Click
Add users. - In the window that opens, select the required user or user group.
- Click Add.
- Log in to Yandex Identity Hub
Make sure your application works correctly
To make sure both your SAML app and GitLab integration work correctly, authenticate to GitLab as one of the users you added to the app. Proceed as follows:
- In your browser, open the URL of your GitLab instance, e.g.,
https://example.gitlab.yandexcloud.net. - If you are already authenticated in GitLab, log out.
- On the GitLab authentication page, click the name of the authentication provider you created (
Identity Hubin this example). - On the Yandex Cloud authentication page, enter the user email address and password. The user or group they belong to must be added to the application. The user must also have their email address specified.
- Make sure you have successfully authenticated in GitLab.