> For the complete documentation index, see [llms.txt](https://docs.dispel.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.dispel.com/documentation/documentation-zh/bao-hu-yu-zhi-li/identity-providers.md). Agents can also search and read this documentation through its [MCP server](https://docs.dispel.com/~gitbook/mcp).

# 身份提供方（SSO）

让用户使用你现有的身份提供方登录 Dispel。通过 OAuth（OIDC）或 SAML 连接 Microsoft Entra ID、Okta 或 PingIdentity，实现单点登录。

## 概述

连接身份提供方（IdP）后，用户便可使用他们在其他地方已在使用的企业凭据登录 Dispel，即实现单点登录（SSO）。无需单独管理 Dispel 密码，身份提供方会处理身份验证，并告知 Dispel 用户身份。

Dispel 支持四种身份提供方。Active Directory 通过 LDAP(S) 连接；Microsoft Entra ID、Okta 和 Ping Identity 则分别通过 OAuth (OIDC) 或 SAML 连接：

* [**Active Directory**](https://docs.dispel.com/documentation/documentation-zh/bao-hu-yu-zhi-li/identity-providers/active-directory.md) ——Microsoft 的本地目录服务。
* [**Microsoft Entra ID**](https://docs.dispel.com/documentation/documentation-zh/bao-hu-yu-zhi-li/identity-providers/microsoft-entra-id.md) ——Microsoft 的云身份平台（原 Azure AD）。
* [**Okta**](https://docs.dispel.com/documentation/documentation-zh/bao-hu-yu-zhi-li/identity-providers/okta.md) ——Okta 的企业身份平台。
* [**PingIdentity**](https://docs.dispel.com/documentation/documentation-zh/bao-hu-yu-zhi-li/identity-providers/ping-identity.md) ——Ping 的联合身份平台。

{% hint style="info" %}
**查找位置。** 以组织管理员身份登录并打开 **设置 → 集成** （或专用的 **设置 → 身份验证** 页面）。这些提供方显示在 **身份与身份验证（IdP / SSO）** 部分。点击提供方旁的 **连接** 即可开始。
{% endhint %}

{% hint style="warning" %}
**每个组织只能使用一个身份提供方。** 一个组织同一时间只能有一个处于活动状态的 IdP，并且只能使用一种协议。若要切换提供方，或将现有提供方从 OAuth 切换为 SAML（反之亦然），必须先断开当前提供方。
{% endhint %}

## 选择协议

所用协议取决于你要连接的提供方：

* Active Directory 仅通过 LDAP(S) 连接。
* Microsoft Entra ID、Okta 和 Ping Identity 均支持 OAuth (OIDC) 和 SAML。配置这些提供方时，你可以从这两种协议中选择一种。每个提供方同一时间只能启用一种协议。

对于这三种云提供方，请根据 IdP 应用的设置方式选择 OIDC 或 SAML：

| 协议               | 说明                               | 适用情况                                  |
| ---------------- | -------------------------------- | ------------------------------------- |
| **OAuth** （OIDC） | 一种用于委托访问权限的开放标准，常用于基于令牌的身份验证。    | 你的 IdP 应用配置为 OIDC / OAuth 应用。         |
| **SAML**         | 一种基于 XML 的框架，用于在各方之间交换身份验证和授权数据。 | 你的 IdP 应用配置为 SAML 应用，或组织采用 SAML 作为标准。 |

> Active Directory 使用 LDAP(S)——一种用于查询目录服务器并通过其进行身份验证的协议，并由 TLS 提供保护。由于 AD 仅支持 LDAP(S)，因此无需为其选择协议。

## 你需要提供的信息，以及 Dispel 提供的信息

设置 SSO 需要双方交换信息。你需要向 Dispel 提供 IdP 的详细信息；如果使用 SAML，还需将 Dispel 的服务提供方信息复制到 IdP 中。

#### OAuth (OIDC)

你需要在 Dispel 中填写以下信息：

| 字段          | 填写内容                                                  |
| ----------- | ----------------------------------------------------- |
| **客户端 URL** | OAuth 令牌的接收 URL，可在 IdP 设置中找到。                         |
| **客户端 ID**  | IdP 的唯一标识符（通常是 URL 或 URN），可在 IdP 设置中找到。               |
| **客户端密钥**   | IdP 签发的客户端密钥。                                         |
| **组织标识符**   | 由 *你* 选择的唯一标识符。用户在 Dispel 登录界面输入此标识符。仅限字母、数字、连字符和下划线。 |

在 IdP 端，将 Dispel 注册为应用，并将其 **重定向 URI** 设置为你的 Dispel 地址后接 `/oauth/login-callback` （例如， `https://app.dispel.com/oauth/login-callback`）。如果不确定适用于您环境的确切地址，请向您的 Dispel 代表确认。

#### SAML

Dispel 会在 SAML 表单顶部显示两个只读值，请将它们粘贴到 IdP 的 SAML 应用中：

| Dispel 提供的值          | 在 IdP 中粘贴为                   |
| -------------------- | ---------------------------- |
| **服务提供商 (SP) 实体 ID** | SP 实体 ID / 受众。               |
| **断言消费者服务 URL**      | ACS URL / 回复 URL / 单点登录 URL。 |

使用每项旁边的 **复制 ID** 和 **复制 URL** 按钮。然后在 Dispel 中填写以下内容：

| 字段              | 填写内容                                              |
| --------------- | ------------------------------------------------- |
| **SSO URL**     | SAML 断言发送到的 URL，可在 IdP 设置中找到。                     |
| **身份提供商实体 ID**  | IdP 的唯一标识符（通常为 URL 或 URN）。                        |
| **Base64 签名证书** | IdP 用于签署 SAML 断言的证书。请粘贴证书，或使用 **上传证书** （最大 1 MB）。 |
| **组织标识符**       | 一个由 *您* 选择的唯一标识符。用户在 Dispel 登录页面输入此标识符。           |

#### LDAP(S)

与 SSO 流程不同，LDAP 并非基于重定向的握手流程：Dispel 会直接连接到您的目录，并通过该目录验证用户身份。无需将任何内容粘贴回其他系统；所有配置都在 Dispel 中完成。以下信息由您的 Active Directory 管理员提供。

你需要在 Dispel 中填写以下信息：

| 字段                     | 填写内容                                                                               |
| ---------------------- | ---------------------------------------------------------------------------------- |
| **登录标识符**              | 一个由 *您* 选择的唯一标识符。用户在 Dispel 登录页面输入此标识符。                                            |
| **Active Directory 域** | 您的 AD DNS 域，例如 `corp.example.com`.                                                 |
| **域控制器**               | Dispel 通过 LDAPS（端口 636）连接的域控制器主机名，例如 `dc01.corp.example.com`.                      |
| **证书信任 + CA 证书**       | Dispel 验证 TLS 连接的方式，以及（建议提供）颁发域控制器证书的 CA 证书。请向您的 PKI 或 AD 管理员获取；格式为 PEM、CRT 或 CER。 |
| **绑定 DN 或 UPN**        | Dispel 用于进行身份验证的只读服务账户，例如 `svc-dispel@corp.example.com`.                           |
| **绑定密码**               | 服务账户的密码。                                                                           |
| **用户搜索基准**             | 用于搜索用户的目录位置（OU），例如 `OU=Users,DC=corp,DC=example,DC=com`.                           |
| **组搜索基准**              | 用于搜索组的目录位置（OU）。                                                                    |
| **登录属性**               | 用户输入作为用户名的属性，通常为 `sAMAccountName`.                                                 |

## 设置身份提供商

不同提供商在 IdP 端的具体设置步骤有所不同，详情请参阅各提供商的页面。整体流程相同：

1. 前往 **设置 → 集成** 并点击 **连接** （位于提供商卡片上）。
2. **选择身份验证协议** ——OAuth 或 SAML。
3. *（仅限 SAML）* 将 Dispel 的 **SP 实体 ID** 和 **ACS URL** 填入 IdP 的 SAML 应用中。
4. 使用 IdP 提供的值填写连接字段，并选择一个 **组织标识符**.
5. 点击 **保存设置**.
6. *（仅限 SAML）* 点击 **测试连接**。Dispel 会将你重定向到 IdP 登录，然后显示收到的用户属性（电子邮件、名字、姓氏）。如果测试失败，请检查配置是否与 IdP 的 SAML 应用一致，并确认测试用户已存在于 IdP 中且已受邀加入此组织。

> 要连接 Active Directory？AD 使用 LDAP(S)，流程有所不同——Dispel 会直接连接到你的目录，而不是通过 SSO 握手重定向，并且无需选择协议。完整操作步骤请参阅 [Active Directory 设置指南](https://docs.dispel.com/documentation/documentation-zh/bao-hu-yu-zhi-li/identity-providers/active-directory.md) 。

{% hint style="info" %}
**机密信息会被遮蔽。** 保存后，机密字段（客户端密钥、证书）会被遮蔽。之后编辑时，保留遮蔽字段不变即可继续使用已存储的值。
{% endhint %}

## 用户如何登录

配置 SSO 后，用户将使用 IdP 登录，而非使用 Dispel 密码：

1. 在 Dispel 登录页面，用户输入你的 **组织标识符**.
2. Dispel 会将其重定向到 IdP 进行身份验证。
3. 验证成功后，用户会返回 Dispel 并完成登录。

Dispel 会从 IdP 响应中读取用户的 **电子邮件**, **名字**和 **姓氏** 。

{% hint style="info" %}
**必须先邀请用户。** SSO 会验证用户身份，但不会自动授予访问权限。用户必须先受邀加入 Dispel 中的组织，才能通过 SSO 登录。请参阅 [邀请用户加入 Dispel](https://docs.dispel.com/documentation/documentation-zh/guan-li-yong-hu-he-fang-wen/users/invite-a-user.md).
{% endhint %}

## 组映射

你可以根据用户在 IdP 中所属的组，自动将 SSO 用户加入 Dispel 组。Dispel 会按计划同步组成员身份，确保访问权限与 IdP 保持一致。请参阅 [组映射](https://docs.dispel.com/documentation/documentation-zh/ji-cheng-yu-guan-li/integrations/group-mapping.md).

## SSO 与多因素身份验证

使用 SSO 时，身份验证由 IdP 负责，包括你在 IdP 中强制执行的任何 MFA。因此，通过 SSO 登录的用户不会使用 Dispel 的电子邮件一次性验证码。在制定 MFA 要求时，请将这一点纳入考量，相关设置位于 [策略构建器](https://docs.dispel.com/documentation/documentation-zh/bao-hu-yu-zhi-li/policy-builder.md).

## 切换或断开提供商连接

要更换提供商，或将提供商从 OAuth 切换为 SAML， **请先断开** 当前集成，然后连接新的提供商。

{% hint style="warning" %}
**断开连接会强制用户重置密码。** 移除 SSO 集成后，受影响的用户将无法再通过 IdP 登录——他们需要重置 Dispel 密码才能重新登录，而您需要重新填写所有字段才能重新连接。
{% endhint %}

## 常见问题

<details>

<summary>可以同时使用多个身份提供商吗？</summary>

不可以。一个组织同一时间只能有一个处于活动状态的 IdP。如果您已连接到某个提供商，其他提供商将不可用，直到您断开连接为止——您会看到一条提示，说明当前已连接到另一个提供商，必须先断开连接。

</details>

<details>

<summary>可以对同一个提供商同时使用 OAuth 和 SAML 吗？</summary>

不可以。每个身份提供商同一时间仅支持一种身份验证协议。要切换协议，请先断开连接，再使用另一种协议重新连接。

</details>

<details>

<summary>什么是组织标识符？</summary>

这是您选择的简短且唯一的标签（可包含字母、数字、连字符和下划线）。用户在 Dispel 登录页面输入该标签，Dispel 据此确定应将他们发送到哪个 IdP。

</details>

<details>

<summary>用户首次通过 SSO 登录时会自动获得账户吗？</summary>

只有在他们已受邀加入您的组织时才会。SSO 用于验证用户身份，但用户必须在 Dispel 中收到邀请才能获得访问权限。

</details>

<details>

<summary>谁可以配置 SSO？</summary>

组织管理员。配置或断开身份提供商需要拥有组织编辑权限。

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.dispel.com/documentation/documentation-zh/bao-hu-yu-zhi-li/identity-providers.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
