Skip to content
You are reading the docs for version 0.7. The current one is 0.8. Switch →

GitLab (Self-Managed) — вход через Zentro

This content is not available in your language yet.

Вход в GitLab через Zentro (OmniAuth OpenID Connect). Для Omnibus-установки — /etc/gitlab/gitlab.rb.

redirect_uris: https://gitlab.example.com/users/auth/openid_connect/callback, scopes openid email profile, permission_namespace: "GITLAB" (если администраторов GitLab назначать правами Zentro). См. README.

gitlab_rails['omniauth_enabled'] = true
gitlab_rails['omniauth_allow_single_sign_on'] = ['openid_connect'] # создавать пользователя при первом входе
gitlab_rails['omniauth_block_auto_created_users'] = false
gitlab_rails['omniauth_auto_link_user'] = ['openid_connect'] # привязать к существующему по email
gitlab_rails['omniauth_providers'] = [
{
name: "openid_connect",
label: "Zentro",
args: {
name: "openid_connect",
scope: ["openid", "profile", "email"],
response_type: "code",
issuer: "https://id.example.com",
discovery: true,
client_auth_method: "basic",
uid_field: "sub",
pkce: true,
client_options: {
identifier: "<client_id>",
secret: "<client_secret>",
redirect_uri: "https://gitlab.example.com/users/auth/openid_connect/callback"
}
}
}
]

gitlab-ctl reconfigure. На странице входа появится кнопка «Zentro».

Пользователь уже прошёл второй фактор в Zentro (в токене amr содержит mfa, acr = AAL2/AAL3) — повторная 2FA GitLab не нужна:

gitlab_rails['omniauth_allow_bypass_two_factor'] = ['openid_connect']

Обязательность MFA задаётся политикой Zentro (Настройки → MFA), а не в GitLab.

4. Администраторы и доступ по правам Zentro (GitLab Premium / Ultimate)

Заголовок раздела «4. Администраторы и доступ по правам Zentro (GitLab Premium / Ultimate)»

GitLab умеет назначать администраторов и ограничивать вход по группам из claim. В Zentro группами служат права приложения (permissions): заведите роли с правами GITLAB:*:ADMIN (администраторы) и GITLAB:*:USER.

# внутри args провайдера:
groups_attribute: "permissions",
admin_groups: ["GITLAB:*:ADMIN"],
required_groups: ["GITLAB:*:USER", "GITLAB:*:ADMIN"],

На GitLab Free эти параметры не действуют — права администраторов назначаются в самом GitLab.

  • Zentro → карточка приложения → «Проверить»: redirect URI GitLab доступен.
  • Invalid redirect_uri — адрес в Zentro не совпадает побайтно с redirect_uri в gitlab.rb (http/https, слеш).
  • Пользователь создаётся без почты — в приложении Zentro нет scope email или у пользователя нет почты.