单点登录 (SSO)
Page summary:
单点登录(SSO)允许管理员通过身份提供者(如 Azure AD)进行身份验证,而不是使用本地密码。本指南的配置步骤涵盖了启用 SSO 和映射角色。
可以在 Strapi 应用上提供单点登录 (SSO) 功能,以允许管理员通过身份提供者(例如 Microsoft Azure Active Directory)进行身份验证。
🌐 The Single Sign-On (SSO) feature can be made available on a Strapi application to allow administrators to authenticate through an identity provider (e.g. Microsoft Azure Active Directory).

配置
🌐 Configuration
SSO 的常规设置在管理面板中可用,并且可以通过 Strapi 项目的代码配置其他 SSO 提供程序。
🌐 General settings for SSO are available in the admin panel, and additional SSO providers can be configured via your Strapi project's code.
管理面板设置
🌐 Admin panel settings
配置此功能的路径: 全局设置 > 单点登录
-
在单点登录界面中,定义你选择的新设置: | 设置名称 | 说明 || --- | ---|| 自动注册 | 点击 True 以允许在 SSO 登录未匹配现有 Strapi 管理员账户时自动创建新的 Strapi 管理员。如果此设置为 False,则必须预先手动创建新的 Strapi 管理员账户。 || 默认角色 | 从下拉列表中选择通过 SSO 登录自动注册的 Strapi 管理员默认分配的角色。 || 本地身份验证锁定 | 从下拉列表中选择禁用本地身份验证功能的角色(请参阅 用户与权限功能 文档)。
被锁定无 法进行本地身份验证的用户将被强制使用 SSO 登录,并且无法更改或重置其密码。 | -
点击 保存 按钮。
在“本地身份验证锁定”的角色列表中不要选择 超级管理员。如果选择了 超级管理员,可能会不小心将自己完全锁出 Strapi 管理面板。修复将很快提供。
🌐 Don't select Super Admin in the roles list for the Local authentication lock-out. If Super Admin is selected, it becomes possible to accidentally lock oneself out of the Strapi admin panel entirely. A fix will be provided soon.
与此同时,如果超级管理员无法登录,唯一的方式是暂时完全禁用单点登录(SSO)功能,使用用户名和密码登录以将 超级管理员 角色从 本地认证锁定 列表中移除,然后重新启用 SSO。
🌐 In the meantime, the only way to get in if the Super Admin can't log in is to temporarily disable the SSO feature entirely, log in with username and password to remove the Super Admin role from the Local authentication lock-out list, and then re-enable SSO.

基于代码的配置
🌐 Code-based configuration
SSO 配置位于 /config/admin 文件。以下专门的指南将帮助你为 Strapi 管理面板配置额外的登录和注册方法:
🌐 The SSO configuration lives in the /config/admin file. The following dedicated guide will help you configure additional sign-in and sign-up methods for the Strapi admin panel:
使用
🌐 Usage
要使用特定提供商访问管理面板,而不是使用常规 Strapi 管理员账户登录:
🌐 To access the admin panel using a specific provider instead of logging in with a regular Strapi administrator account:
- 转至 Strapi 应用管理面板的 URL。
- 点击所选提供商,其徽标应显示在登录表单底部。如果你看不到你的提供商,请点击 按钮以访问所有可用提供商的完整列表。
- 你将被重定向到提供者自己的登录页面,你可以在其中进行身份验证。