Skip to main content

Integrate with GitLab

Support level: authentik

What is GitLab?

GitLab is a complete DevOps platform with features for version control, CI/CD, issue tracking, and collaboration, facilitating efficient software development and deployment workflows.

-- https://about.gitlab.com/what-is-gitlab/

info

In case something goes wrong with the configuration or you need to log in as admin, you can use the URL https://gitlab.company/users/sign_in?auto_sign_in=false to log in using the built-in authentication.

Preparation

The following placeholders are used in this guide:

  • gitlab.company is the FQDN of the GitLab installation.
  • authentik.company is the FQDN of the authentik installation.
info

This documentation lists only the settings that you need to change from their default values. Be aware that any changes other than those explicitly mentioned in this guide could cause issues accessing your application.

Configuration methods

There are two ways to configure single sign-on for GitLab. You can configure it via SAML authentication or via OpenID Connect.

authentik configuration

Redirect URI changes in authentik 2026.5

In authentik versions earlier than 2026.5, all Redirect URIs are automatically treated as Authorization type. If you are using one of these older authentik versions, add only the Authorization URL to your Redirect URIs and do not configure a Post Logout URI.

To support the integration of GitLab with authentik, you need to create an application/provider pair in authentik.

Create an application and provider in authentik

  1. Log in to authentik as an admin and open the authentik Admin interface.
  2. Navigate to Applications > Applications and click New Application.
    • Application: Provide a descriptive name, an optional group, and UI settings. Take note of the slug as it will be required later.
    • Choose a Provider type: Select SAML Provider.
    • Configure the Provider:
      • Set the ACS URL to https://gitlab.company/users/auth/saml/callback.
      • Set the Audience to https://gitlab.company.
      • Under Advanced protocol settings, select an available Signing certificate.
  3. Click Submit to save the new application and provider.

GitLab configuration

Paste the following block in your /etc/gitlab/gitlab.rb file:

gitlab_rails['omniauth_enabled'] = true
gitlab_rails['omniauth_allow_single_sign_on'] = ['saml']
gitlab_rails['omniauth_sync_email_from_provider'] = 'saml'
gitlab_rails['omniauth_sync_profile_from_provider'] = ['saml']
gitlab_rails['omniauth_sync_profile_attributes'] = ['email']
gitlab_rails['omniauth_auto_sign_in_with_provider'] = 'saml'
gitlab_rails['omniauth_block_auto_created_users'] = false
gitlab_rails['omniauth_auto_link_saml_user'] = true
gitlab_rails['omniauth_providers'] = [
{
name: 'saml',
args: {
assertion_consumer_service_url: 'https://gitlab.company/users/auth/saml/callback',
# Shown when navigating to certificates in authentik
idp_cert_fingerprint: '4E:1E:CD:67:4A:67:5A:E9:6A:D0:3C:E6:DD:7A:F2:44:2E:76:00:6A',
idp_sso_target_url: 'https://authentik.company/application/saml/<application_slug>/',
issuer: 'https://gitlab.company',
name_identifier_format: 'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent',
attribute_statements: {
email: ['http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress'],
first_name: ['http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name'],
nickname: ['http://schemas.goauthentik.io/2021/02/saml/username']
}
},
label: 'authentik'
}
]

Run gitlab-ctl reconfigure or restart the container after making changes.

SCIM provisioning (optional)

GitLab self-managed instances expose SCIM endpoints for user and group provisioning when SCIM is enabled in GitLab. Use the SCIM API endpoint URL and token shown in GitLab's SCIM configuration.

Create a SCIM provider

  1. Log in to authentik as an administrator and open the authentik Admin interface.
  2. Navigate to Applications > Providers and click Create.
  3. Select SCIM Provider as the provider type and click Next.
  4. Enter the following values:
    • Name: Choose a descriptive name.
    • URL: Paste the SCIM API endpoint URL from GitLab.
    • Token: Paste the SCIM token from GitLab.
    • Compatibility Mode: Select GitLab.
  5. Click Finish to save the provider.

Add the SCIM provider to your application

  1. Log in to authentik as an administrator and open the authentik Admin interface.
  2. Navigate to Applications > Applications and select your GitLab application.
  3. Click Edit.
  4. In the Backchannel Providers field, select the SCIM provider you created.
  5. Click Update to save the application.