> For the complete documentation index, see [llms.txt](https://enterprise-ua.hideez.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://enterprise-ua.hideez.com/integraciyi-servera-hideez/saml-integraciyi/nalashtuvannya-saml-dlya-gitlab-on-premises.md).

# Налаштування SAML для GitLab (on premises)

### Налаштування GitLab

Відредагуйте файл “/etc/gitlab/gitlab.rb”:

```
### OmniAuth Settings
###! Docs: https://docs.gitlab.com/ee/integration/omniauth.html
gitlab_rails['omniauth_enabled'] = true
gitlab_rails['omniauth_allow_single_sign_on'] = ['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.hideez.com/users/auth/saml/callback',
               idp_cert: 'MIIDHjCCAgagAwIBAg........',
               idp_sso_target_url: 'https://publicdemo.hideez.com/saml/login',
               issuer: 'https://gitlab.hideez.com',
               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'] }
             }
    }
  ]
```

Після редагування виконайте команду `sudo gitlab-ctl reconfigure`.

### Налаштування HES

* Перейдіть до **Налаштування -> Параметри ->** розділ **SAML**
* Натисніть кнопку **Додати постачальника послуг:**
  * **Емітент** - **Entity ID з** GitLab
  * **Ствердження споживчої служби** - **ACS URL з** GitLab
  * **NameID формат** - Email
  * **NameID значення -** Електронна пошта
