如何使用 Azure 配置 OIDC SSO
本指南将使用 Azure 作为 SSO 提供程序,并将 Open ID Connect (OIDC) 协议作为首选身份协议。
步骤 1:在您的身份提供程序中创建一个新的应用程序
在浏览器中打开一个新的标签/窗口,并登录到您组织的 Azure 门户。
导航到 Microsoft Entra ID 管理中心,然后点击“企业应用程序”。

您将被重定向到此页面。然后点击顶部的“新建应用程序”和“创建您自己的应用程序”。

输入应用程序的名称(例如,Hugging Face SSO),然后选择“注册一个与 Microsoft Entra ID 集成的应用程序(您正在开发的应用程序)”。

步骤 2:在 Azure 上配置您的应用程序
在浏览器中打开一个新的标签/窗口,并导航到您组织设置的 SSO 部分。选择 OIDC 协议。




从 Hugging Face 的组织设置中复制“重定向 URI”,并将其粘贴到 Azure Entra ID 的“重定向 URI”字段中。确保在下拉菜单中选择“Web”。该 URL 如下所示:https://huggingface.co/organizations/[organizationIdentifier]/oidc/consume
。

保存您的新应用程序。
步骤 3:完成 Hugging Face 上的配置
我们需要收集以下信息以完成 Hugging Face 上的设置
- OIDC 应用程序的客户端 ID
- OIDC 应用程序的客户端密钥
- OIDC 应用程序的发行者 URL
在 Microsoft Entra ID 中,导航到企业应用程序,然后点击列表中您新创建的应用程序。

在应用程序概述中,点击“单点登录”,然后点击“转到应用程序”。

在 OIDC 应用程序概述中,您将找到一个名为“应用程序(客户端)ID”的可复制字段。复制该 ID 到剪贴板,并将其粘贴到 Huggingface 的“客户端 ID”字段中。

接下来,在 Microsoft Entra 的顶部菜单中点击“端点”。复制“OpenID connect 元数据文档”字段中的值,并将其粘贴到 Hugging Face 的“发行者 URL”字段中。

返回 Microsoft Entra,导航到“证书和密钥”,并通过点击“新建客户端密钥”生成一个新的密钥。

创建密钥后,复制密钥值并将其粘贴到 Hugging Face 的“客户端密钥”字段中。

您现在可以点击“更新并测试 OIDC 配置”以保存设置。
您应该会被重定向到 SSO 提供程序 (IdP) 登录提示。登录后,您将被重定向到您组织的设置页面。
OIDC 选择器附近的绿色复选标记将证明测试成功。


步骤 4:在您的组织中启用 SSO
现在单点登录已配置并经过测试,您可以通过点击“启用”按钮为组织成员启用它。
启用后,组织成员必须完成 它是如何工作的? 中描述的 SSO 身份验证流程。
< > 在 GitHub 上更新