在 Identity Platform 中设置多租户
本快速入门介绍如何为 Identity Platform 启用多租户,以及如何使用 Google Cloud 控制台创建和选择新租户。
如需详细了解 Identity Platform 中的多租户,请参阅多租户。
如需在 Google Cloud 控制台中直接遵循有关此任务的分步指导,请点击操作演示:
准备工作
- 登录您的 Google Cloud 账号。如果您是 Google Cloud新手,请 创建一个账号来评估我们的产品在实际场景中的表现。新客户还可获享 $300 赠金,用于运行、测试和部署工作负载。
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
If you're using an existing project for this guide, verify that you have the permissions required to complete this guide. If you created a new project, then you already have the required permissions.
-
Verify that billing is enabled for your Google Cloud project.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
If you're using an existing project for this guide, verify that you have the permissions required to complete this guide. If you created a new project, then you already have the required permissions.
-
Verify that billing is enabled for your Google Cloud project.
所需的角色
如需获得设置多租户所需的权限,请让您的管理员为您授予项目的 Identity Platform Admin (roles/identityplatform.admin) IAM 角色。如需详细了解如何授予角色,请参阅管理对项目、文件夹和组织的访问权限。
此预定义角色包含设置多租户所需的权限。如需查看所需的确切权限,请展开所需权限部分:
所需权限
如需设置多租户,您需要具备以下权限:
-
firebaseauth.configs.update -
identitytoolkit.tenants.create
启用多租户
在 Google Cloud 控制台中,前往 Identity Platform > 设置页面。
前往“设置”点击安全标签。
在多租户部分,点击允许多租户。
此操作会启用多租户并打开租户页面。
您现在可以创建第一个租户了。
创建租户
在租户页面中,点击添加租户。
在名称字段中,输入租户的名称。 该名称不必是唯一的;Identity Platform 会自动分配不同的 ID。
点击保存。
恭喜!您已创建 Identity Platform 租户。
选择租户
在设置页面中,从限定到租户列表中选择您的租户。
每个租户都有自己的提供商和用户。选择租户后,您可以像管理非租户 Identity Platform 项目一样管理该租户。
停用多租户
如需停用多租户,请使用 Identity Toolkit API。