doc/tutorials/auth/saml_saas.md
This tutorial walks you through setting up SAML single sign-on (SSO) for a GitLab.com group using an Identity Provider (IdP) such as Okta or Microsoft Entra ID. When you finish, members of your group can sign in to GitLab through the IdP.
In this tutorial, you:
Prerequisites:
Time to complete: 20-30 minutes
Before you can set up anything in your IdP, you must get some connection details from GitLab that tell your IdP how to communicate with your GitLab group.
To gather the GitLab information:
Now that you have your GitLab details ready, create an application in your IdP. This application maps the GitLab information to the IdP and configures how user information flows between the two systems.
To create an IdP application:
{{< tabs >}}
{{< tab title="Okta" >}}
GitLab SAML.user.getInternalProperty("id").emailuser.emailThe SAML application is created in Okta.
[!note] For more information about SAML attributes and advanced configuration options, see the SAML SSO documentation.
{{< /tab >}}
{{< tab title="Entra ID" >}}
GitLab SAML.The enterprise application is created in Microsoft Entra ID.
email.user.mail.user.objectid.[!note] For more information about SAML attributes and advanced configuration options, see the SAML SSO documentation.
{{< /tab >}}
{{< tab title="Google Workspace" >}}
GitLab SAML.Primary email, App attribute: emailFirst name, App attribute: first_nameLast name, App attribute: last_nameFor more information about SAML attributes and advanced configuration options, see the SAML SSO documentation.
{{< /tab >}}
{{< tab title="OneLogin" >}}
GitLab SAML.https://gitlab\.com/groups/your-group/-/saml/callback.email, Value: EmailThe SAML application is created in OneLogin.
For more information about SAML attributes and advanced configuration options, see the SAML SSO documentation.
{{< /tab >}}
{{< tab title="Keycloak" >}}
persistent.email.The SAML client is created in Keycloak.
[!note] For more information about SAML attributes and advanced configuration options, see the SAML SSO documentation.
{{< /tab >}}
{{< tab title="AWS IAM Identity Center" >}}
Sign in to the AWS IAM Identity Center console.
Select Applications, then select Add application.
Select I have an application I want to set up.
Select SAML 2.0 as the application type.
Select Next.
On the Configure application page, enter a display name for your application. For example, GitLab SAML.
Complete the fields with the values from Step 1:
Under Attribute mappings, configure these attributes:
${user:email}, Format: unspecified${user:email}, Format: unspecified${user:givenName}, Format: unspecified${user:familyName}, Format: unspecified[!warning] To avoid authentication errors for existing GitLab users, do not set the format to
persistentortransient.
Select Submit. The SAML application is created in AWS IAM Identity Center.
Assign users to the GitLab application.
For more information about SAML attributes and advanced configuration options, see the SAML SSO documentation.
[!note] AWS IAM Identity Center defaults to IdP-initiated login. To link existing GitLab accounts, users must sign in from the GitLab single sign-on URL or the Application start URL.
{{< /tab >}}
{{< /tabs >}}
Now retrieve the information that GitLab needs to send authentication requests to the IdP.
To gather the connection details:
{{< tabs >}}
{{< tab title="Okta" >}}
In your Okta SAML app, select the Sign On tab.
On the right side, select View SAML setup instructions.
Note the Identity Provider Single Sign-On URL.
Generate a certificate fingerprint:
# Replace `<certificate_filename>` with the actual filename of your downloaded certificate.
# You might need to install OpenSSL or use an alternative method to generate the fingerprint.
openssl x509 -noout -fingerprint -sha256 -in <certificate_filename>.crt
Copy the fingerprint value after SHA256 Fingerprint=.
The fingerprint looks like A1:B2:C3:D4:E5:F6:....
{{< /tab >}}
{{< tab title="Entra ID" >}}
A1B2C3D4E5F6....{{< /tab >}}
{{< tab title="Google Workspace" >}}
A1:B2:C3:D4:E5:F6:....{{< /tab >}}
{{< tab title="OneLogin" >}}
A1:B2:C3:D4:E5:F6:....{{< /tab >}}
{{< tab title="Keycloak" >}}
idp-metadata.xml.<md:SingleSignOnService> tag and note the value of the Location attribute.<ds:X509Certificate> tag and copy the value to a separate file.-----BEGIN CERTIFICATE----- at the beginning of the file and -----END CERTIFICATE----- at the end of the file as new lines.{{< /tab >}}
{{< tab title="AWS IAM Identity Center" >}}
In your AWS IAM Identity Center SAML app, select the application you created.
In the IAM Identity Center SAML metadata section, note the IAM Identity Center sign-in URL.
Download the certificate.
Generate a certificate fingerprint:
# Replace `<certificate_filename>` with the actual filename of your downloaded certificate.
# You might need to install OpenSSL or use an alternative method to generate the fingerprint.
openssl x509 -noout -fingerprint -sha256 -in <certificate_filename>.pem
Copy the fingerprint value after SHA1 Fingerprint=.
The fingerprint looks like A1:B2:C3:D4:E5:F6:....
[!note] AWS IAM Identity Center requires a SHA1 fingerprint. For more information, see the SAML SSO documentation.
{{< /tab >}}
{{< /tabs >}}
You have everything you need to complete the connection. Return to GitLab and enter the connection details to turn on SAML authentication for your group.
To configure SAML:
The basic SAML connection is now configured.
[!note] You can set the default membership role to any role. All new users are assigned this role when they first sign in through SAML. Setting the default to Minimal Access and promoting users later reduces the risk of users having too much access.
Before you invite your team, verify that the connection works correctly.
To test the SAML configuration:
If you see errors, see the troubleshooting guide.
The configuration looks good. Now test the experience from a user's perspective by linking a test account like your team members do when they first connect to GitLab through the IdP.
To test user account linking:
Congratulations! You have successfully linked a SAML identity to a GitLab account.
You have a working SAML setup. As an optional final step, you can turn on SSO enforcement. SSO enforcement requires all group members to authenticate through the IdP, which strengthens security. However, it prevents access through other authentication methods.
To turn on SSO enforcement:
After you enable enforcement, all group members must sign in through the IdP before they can access group resources.
You've successfully set up SAML SSO for your GitLab group! Here are some things you might want to do next:
If you encounter issues during this tutorial, see the following resources: