OIDC 管理

平台支持 OIDC(OpenID Connect)协议,平台管理员在添加 OIDC 配置后,可以使用第三方账号登录平台。平台管理员还可以更新和删除已配置的 OIDC 服务。

目录

OIDC 概述

OIDC(OpenID Connect)是一种基于 OAuth 2.0 协议的身份认证标准协议。它使用 OAuth 2.0 授权服务器为第三方客户端提供用户身份认证,并将相应的身份认证信息传递给客户端。

OIDC 允许所有类型的客户端(包括服务器端、移动端和 JavaScript 客户端)请求并接收经过认证的会话和终端用户信息。该规范套件具有可扩展性,允许参与者在有意义时使用可选功能,如身份数据加密、OpenID Provider 发现和会话管理。更多信息请参见 OIDC 官方文档

添加 OIDC

通过添加 OIDC,您可以使用第三方平台账号登录平台。

注意:OIDC 用户成功登录平台后,平台将使用用户的 email 属性作为唯一标识。支持 OIDC 的第三方平台用户必须具备 email 属性,否则无法登录平台。

操作步骤

  1. 在左侧导航栏点击 Users > IDPs

  2. 点击 Add OIDC

  3. 配置 Basic Information 参数。

  4. 配置 OIDC Server Configuration 参数:

    • Identity Provider URL:发行者 URL,即 OIDC 身份提供者的访问地址。

    • Client ID:OIDC 客户端的客户端标识符。

    • Client Secret:OIDC 客户端的密钥。

    • Redirect URI:登录第三方平台后的回调地址,即 dex 发行者的 URL + /callback

    • Logout URL:用户执行 Logout 操作后访问的地址,若为空,则登出地址为平台的初始登录页面。

  5. IDP Service Configuration Validation 区域,输入有效 OIDC 账号的 UsernamePassword 以验证配置。

    提示:若用户名或密码错误,添加时会报错提示凭证无效,无法添加 OIDC。

  6. 点击 Create

通过 YAML 添加 OIDC

除了表单配置外,平台还支持通过 YAML 添加 OIDC,允许更灵活地配置认证参数、声明映射、用户组同步等高级功能。

示例:配置 OIDC Connector

以下示例展示了如何配置 OIDC connector 以集成 OIDC 身份认证服务。该配置示例适用于以下场景:

  1. 需要集成 OIDC 作为身份认证服务器。

  2. 需要支持用户组信息同步。

  3. 需要自定义登出重定向地址。

  4. 需要配置特定的 OIDC scopes。

  5. 需要自定义声明映射。

apiVersion: dex.coreos.com/v1
kind: Connector
# Connector basic information
id: oidc               # Connector unique identifier
name: oidc             # Connector display name
type: oidc             # Connector type is OIDC
metadata:
  annotations:
    cpaas.io/description: "11"  # Connector description
  name: oidc
  namespace: cpaas-system
spec:
  config:
    # OIDC server configuration
    # Configure server connection information, including server address, client credentials, and callback address
    issuer: http://auth.com/auth/realms/master               # OIDC server address
    clientID: dex                                            # Client ID
    # Service account secret key, valid when creating Connector resources for the first time
    clientSecret: xxxxxxx
    redirectURI: https://example.com/dex/callback            # Callback address, must match the address registered by the OIDC client

    # Security configuration
    # Configure SSL verification and user information acquisition method
    insecureSkipVerify: true                                # Whether to skip SSL verification, it is recommended to set to false in a production environment
    getUserInfo: false                                      # Whether to obtain additional user information through the UserInfo endpoint

    # Logout configuration
    # Configure the redirect address after user logout
    logoutURL: https://test.com                            # Logout redirect address, can be customized to the page jumped after user logout

    # Scope configuration
    # Configure the required authorization scope, ensure that the OIDC server supports these scopes
    scopes:
      - openid                                             # Required, used for OIDC basic authentication
      - profile                                            # Optional, used to obtain user basic information
      - email                                              # Optional, used to obtain user email

    # Claim mapping configuration
    # Configure the mapping relationship between OIDC returned claims and platform user attributes
    claimMapping:
      email: email                                         # Email mapping, used for user unique identification
      groups: groups                                       # User group mapping, used for organization structure
      phone: ""                                            # Phone mapping, optional
      preferred_username: preferred_username               # Username mapping, used for display name

    # User group configuration
    # Configure user group synchronization related parameters, ensure that the token contains group information
    groupsKey: groups                                      # Specify the key name of group information
    insecureEnableGroups: false                           # Whether to enable group synchronization function

相关操作

您可以在列表页面点击右侧的 或在详情页面右上角点击 Actions,根据需要更新或删除 OIDC。

操作描述
更新 OIDC更新已添加的 OIDC 配置。更新 OIDC 配置信息后,原有用户和认证方式将被重置,并根据当前配置进行同步。
删除 OIDC删除平台不再使用的 OIDC。删除 OIDC 后,通过该 OIDC 同步到平台的所有用户状态将变为 Invalid(用户与角色的绑定关系保持不变),且无法登录平台。重新集成后,用户可通过成功登录平台激活。

提示:删除 IDP 后,如需删除通过 OIDC 同步到平台的用户和用户组,请勾选提示框下方的 Clean IDP Users and User Groups 复选框。