设置 SAML#
¥Set up SAML
Feature availability
- Available on Enterprise plans.
- You need to be an instance owner or admin to enable and configure SAML.
启用 SAML#
¥Enable SAML
- 在 n8n 中,转到“设置”>“单点登录 (SSO)”。
¥In n8n, go to Settings > SSO. 2. 记下 n8n 重定向 URL 和实体 ID。
¥Make a note of the n8n Redirect URL and Entity ID.
-
可选的:如果你的身份提供商 (IdP) 允许你从导入的元数据设置 SAML,请导航到实体 ID URL 并保存 XML。
¥Optional: If your IdP allows you to set up SAML from imported metadata, navigate to the Entity ID URL and save the XML.
-
可选的:如果你在负载均衡器后运行 n8n,请确保已配置
N8N_EDITOR_BASE_URL。¥Optional: If you are running n8n behind a load balancer make sure you have
N8N_EDITOR_BASE_URLconfigured. 3. 与你的身份提供商 (IdP) 设置 SAML。你需要重定向 URL 和实体 ID。你可能还需要身份提供商 (IdP) 用户的电子邮件地址和名称。
¥Set up SAML with your identity provider (IdP). You need the Redirect URL and Entity ID. You may also need an email address and name for the IdP user. 4. 完成身份提供商 (IdP) 中的设置后,将元数据 XML 加载到 n8n 中。你可以使用元数据 URL 或原始 XML:
¥After completing setup in your IdP, load the metadata XML into n8n. You can use a metadata URL or raw XML:
-
元数据 URL:将来自你的身份提供商 (IdP) 的元数据 URL 复制到 n8n 的“身份提供商设置”字段中。
¥Metadata URL: Copy the metadata URL from your IdP into the Identity Provider Settings field in n8n.
-
原始 XML:从你的身份提供商 (IdP) 下载元数据 XML,将身份提供商设置切换为 XML,然后将原始 XML 复制到身份提供商设置中。
¥Raw XML: Download the metadata XML from your IdP, toggle Identiy Provider Settings to XML, and then copy the raw XML into Identity Provider Settings. 5. 选择“保存设置”。
¥Select Save settings. 6. 选择“测试设置”以检查 SAML 设置是否正常工作。
¥Select Test settings to check your SAML setup is working. 7. 将 SAML 2.0 设置为“已激活”。
¥Set SAML 2.0 to Activated.
SAML Request Type
n8n 不支持 POST 绑定。配置你的身份提供商 (IdP) 以使用 HTTP 请求绑定。
¥n8n doesn't support POST binding. Configure your IdP to use HTTP request binding instead.
通用身份提供商 (IdP) 设置#
¥Generic IdP setup
配置身份提供商 (IdP) 的步骤因你选择的 IdP 而异。以下是一些常见的设置任务:
¥The steps to configure the IdP vary depending on your chosen IdP. These are some common setup tasks:
- 在你的身份提供商 (IdP) 中为 n8n 创建应用。
¥Create an app for n8n in your IdP.
- 将 n8n 属性映射到 IdP 属性:
¥Map n8n attributes to IdP attributes:
| 值(身份提供商端) | 名称格式 | 名称 |
|---|---|---|
| 用户邮箱 | URI 引用 | http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress |
| 用户名字 | URI 引用 | http://schemas.xmlsoap.org/ws/2005/05/identity/claims/firstname |
| 用户姓氏 | URI 引用 | http://schemas.xmlsoap.org/ws/2005/05/identity/claims/lastname |
| 用户邮箱 | URI 引用 | http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn |
实例和项目访问权限配置#
¥Instance and project access provisioning
从 1.122.2 版本开始,n8n 支持从你的身份提供商 (IdP) 配置实例角色和项目角色。
¥From version 1.122.2 upwards, n8n supports provisioning the instance role and project roles from your IdP.
你需要在身份提供商 (IdP) 的组或单个用户上配置以下属性:
¥You need to configure these attributes on the groups or individual users in your IdP:
| 值(身份提供商端) | 数据类型 | 名称 |
|---|---|---|
n8n_instance_role |
string | n8n_instance_role |
n8n_projects |
array | n8n_projects |
在“设置”>“SSO”页面上的表单中,找到标记为“用户角色配置”的下拉菜单。n8n 会将此下拉列表的默认值设置为“已管理”。
¥On the form on the Settings > SSO page, located the dropdown labeled User role provisioning. n8n sets the default value of this dropdown to Managed in n8n.
你可以选择将其设置为以下值之一:
¥You can choose to set it to one of these values:
- 实例角色
¥Instance role
-
仅从 SAML 响应的
n8n_instance_role属性读取每个已配置用户的实例角色。项目访问权限仍然仅在 n8n 内部管理。¥Only the instance role of each provisioned user is read from the
n8n_instance_roleattribute from the SAML response. Project access is still managed inside n8n only. -
如果你的身份提供商 (IdP) 上未配置
n8n_instance_role的值,则将使用global:member角色作为备用。¥If there is no value for
n8n_instance_roleconfigured on your IdP, theglobal:memberrole is used as fallback. -
实例和项目角色
¥Instance and project roles
-
每个已配置用户的实例角色和项目访问权限均从 SAML 响应中的
n8n_instance_role和n8n_projects属性读取。¥Both the instance role and project access of each provisioned user are read from the
n8n_instance_roleandn8n_projectsattributes from the SAML response.
Existing access will be overwritten
启用 "用户角色配置" 后,下次任何用户通过 SAML 登录时,该用户在 n8n 中被授予的任何访问权限(未反映在 n8n_instance_role 和 n8n_projects 中)都将被移除。
¥Once you enable "User role provisioning", the next time any user logs in via SAML, any access they've been granted inside n8n, which isn't reflected in the n8n_instance_role and n8n_projects will be removed from that user.
启用此功能后,你需要先下载两个 CSV 文件才能保存更改。这些文件包含你当前的所有访问设置,以备需要时参考。
¥When activating this feature, you are required to download two CSV files before you can save this change. These files contain all your current access settings should you need to reference them.
正在配置 n8n_instance_role 属性#
¥Configuring n8n_instance_role attribute
n8n_instance_role 属性是一个字符串,用于配置身份提供商 (IdP) 上的组或用户。
¥The n8n_instance_role attribute is a string configured for a group or user on your IdP.
支持的实例角色:
¥Supported instance roles are:
-
global:member -
global:admin
正在配置 n8n_projects 属性#
¥Configuring n8n_projects attribute
n8n_projects 属性是一个字符串数组,用于配置身份提供商 (IdP) 上的组或用户。
¥The n8n_projects attribute is a string array configured for a group or user on your IdP.
此数组中的每个元素都需要遵循以下格式:<project-id>:<role>
¥Each element in this array needs to follow this format:
<project-id>:<role>
例如:
¥For example:
-
bHsykgeFirmIhezz:viewer -
4K3zrg3DvlMFFTB7:editor -
dCjnYuEpYOUBVaNe:admin
对于通过身份提供商 (IdP) 启用项目访问权限配置时已有的访问设置,你可以在下载的 CSV 文件中找到项目 ID。
¥For existing access settings at the time of enabling project access provisioning through your IdP, you can find the project IDs in the downloaded CSV file.
从头开始创建项目时,请在浏览器中查看项目时从 URL 获取项目 ID。
¥When creating a project from scratch, get the project ID from the URL when viewing the project in your browser:
例如,在 URL <your-domain>/projects/VVRWZaq5DRxaf9O1/workflows 中,项目 ID 为 VVRWZaq5DRxaf9O1。
¥In the URL <your-domain>/projects/VVRWZaq5DRxaf9O1/workflows for example, the project ID is VVRWZaq5DRxaf9O1.
常用身份提供商 (IdP) 的设置资源#
¥Setup resources for common IdPs
常用身份提供商 (IdP) 的文档链接。
¥Documentation links for common IdPs.
| IdP | 文档 |
|---|---|
| Auth0 | 配置 Auth0 作为 SAML 身份提供程序手动配置 SSO 集成 |
| Authentik | 应用 和 SAML 提供程序。 |
| Azure AD | 使用 Azure Active Directory 进行 SAML 身份验证 |
| JumpCloud | 如何使用 JumpCloud 设置 SAML (SSO) 应用(以 Zoom 为例) |
| Keycloak | 根据你的主机选择 入门 指南。 |
| Okta | n8n 提供 员工身份设置指南 和 分步 PDF 指南。 |
| PingIdentity | PingOne 单点登录 (SSO) |