Назначение параметров провайдера описано на странице «Обзор»; место записи и применение изменений — на странице «Настройка».
Провайдер OpenID Connect
Параметры подключения провайдера и их действие описаны в разделе «OpenID Connect (OIDC)».
- Пакет для ОС Linux
- Omnibus Docker
- Helm-чарт
- Модуль Deckhouse Kubernetes Platform
Провайдер — это запись массива gitlab_rails['omniauth_providers']. Ключи allowed_groups, admin_groups, auditor_groups и groups_attribute указываются рядом с name, на верхнем уровне записи; параметры подключения — внутри args:
gitlab_rails['omniauth_providers'] = [
{
name: 'openid_connect', # Не изменяйте это значение.
label: 'Keycloak', # Подпись кнопки входа.
allowed_groups: ['gitlab'],
admin_groups: ['admin'],
auditor_groups: ['audit'],
groups_attribute: 'gitlab_group',
args: {
name: 'openid_connect',
scope: ['openid', 'profile', 'email'],
response_type: 'code',
issuer: 'https://keycloak.example.com/realms/example',
discovery: true,
client_auth_method: 'query',
uid_field: 'preferred_username',
send_scope_to_token_endpoint: false,
pkce: true,
client_options: {
identifier: '<client_id>',
secret: '<client_secret>',
redirect_uri: 'https://code.example.com/users/auth/openid_connect/callback'
}
}
}
]/srv/code/config/gitlab.rb на томе конфигурации.Запись провайдера хранится в объекте Secret и подключается из значений, поэтому секрет клиента остаётся вне values.yaml. Создайте Secret с записью провайдера:
d8 k -n code create secret generic code-omniauth-keycloak \
--from-file=provider=keycloak.yamlФайл содержит ту же запись, что и при остальных типах установки:
name: 'openid_connect'
label: 'Keycloak'
allowed_groups:
- 'gitlab'
admin_groups:
- 'admin'
groups_attribute: 'gitlab_group'
args:
name: 'openid_connect'
scope:
- 'openid'
- 'profile'
- 'email'
response_type: 'code'
issuer: 'https://keycloak.example.com/realms/example'
discovery: true
client_auth_method: 'query'
uid_field: 'preferred_username'
send_scope_to_token_endpoint: false
pkce: true
client_options:
identifier: '<client_id>'
secret: '<client_secret>'
redirect_uri: 'https://code.example.com/users/auth/openid_connect/callback'Подключите Secret в значениях:
global:
appConfig:
omniauth:
providers:
- secret: code-omniauth-keycloak
key: providerПровайдер — это запись параметра providers в секции spec.appConfig.omniauth. Ключи allowedGroups, adminGroups и groupsAttribute указываются рядом с name; параметра для групп аудиторов в ресурсе CodeInstance нет. Параметры подключения указываются внутри args:
providers:
- name: 'openid_connect' # Не изменяйте это значение.
label: 'Keycloak' # Подпись кнопки входа.
allowedGroups:
- 'gitlab'
adminGroups:
- 'admin'
groupsAttribute: 'gitlab_group'
args:
name: 'openid_connect'
scope:
- 'openid'
- 'profile'
- 'email'
response_type: 'code'
issuer: 'https://keycloak.example.com/realms/example'
discovery: true
client_auth_method: 'query'
uid_field: 'preferred_username'
send_scope_to_token_endpoint: false
pkce: true
client_options:
identifier: '<client_id>'
secret: '<client_secret>'
redirect_uri: 'https://code.example.com/users/auth/openid_connect/callback'Интеграция с Deckhouse Platform
В кластере Deckhouse Platform модуль user-authn запускает Dex — провайдер OpenID Connect с адресом https://dex.<домен>/. Deckhouse Code подключается к нему как клиент Dex, описанный в разделе «Настройка OAuth2-клиента в Dex для подключения приложения».
Создайте DexClient в любом неймспейсе кластера. В
allowedGroupsперечислите группы Dex, пользователям которых разрешён вход; без этого параметра войти может любой пользователь Dex:apiVersion: deckhouse.io/v1 kind: DexClient metadata: name: code namespace: code spec: redirectURIs: - https://code.example.com/users/auth/openid_connect/callback allowedGroups: - Everyone - adminsDex регистрирует клиента с идентификатором
dex-client-<name>@<namespace>и сохраняет его секрет в объекте Secretdex-client-<name>того же неймспейса.Получите секрет клиента:
d8 k -n code get secret dex-client-code -o jsonpath='{.data.clientSecret}' | base64 -dДобавьте запись провайдера. Значение
issuerзаканчивается на/и должно в точности совпадать с адресом, который публикует Dex, иначе вход завершается ошибкой.
- Пакет для ОС Linux
- Omnibus Docker
- Helm-чарт
- Модуль Deckhouse Kubernetes Platform
gitlab_rails['omniauth_providers'] = [
{
name: 'openid_connect',
label: 'Deckhouse',
args: {
name: 'openid_connect',
scope: ['openid', 'profile', 'email'],
response_type: 'code',
issuer: 'https://dex.example.com/',
discovery: true,
client_auth_method: 'query',
client_options: {
identifier: 'dex-client-code@code',
secret: '<clientSecret>',
redirect_uri: 'https://code.example.com/users/auth/openid_connect/callback'
}
}
}
]/srv/code/config/gitlab.rb на томе конфигурации.Файл dex.yaml объекта Secret code-omniauth-dex, который подключается в значениях так же, как в разделе «Провайдер OpenID Connect»:
name: 'openid_connect'
label: 'Deckhouse'
args:
name: 'openid_connect'
scope:
- 'openid'
- 'profile'
- 'email'
response_type: 'code'
issuer: 'https://dex.example.com/'
discovery: true
client_auth_method: 'query'
client_options:
identifier: 'dex-client-code@code'
secret: '<clientSecret>'
redirect_uri: 'https://code.example.com/users/auth/openid_connect/callback'Запись параметра providers в секции spec.appConfig.omniauth:
providers:
- name: 'openid_connect'
label: 'Deckhouse'
args:
name: 'openid_connect'
scope:
- 'openid'
- 'profile'
- 'email'
response_type: 'code'
issuer: 'https://dex.example.com/'
discovery: true
client_auth_method: 'query'
client_options:
identifier: 'dex-client-code@code'
secret: '<clientSecret>'
redirect_uri: 'https://code.example.com/users/auth/openid_connect/callback'