

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 使用 Auth0 为亚马逊 WorkSpaces 实施 SAML 2.0 身份验证和 AWS Managed Microsoft AD
<a name="implement-saml-authentication-for-amazon-workspaces-by-using-auth0-and-aws-managed-microsoft-ad"></a>

*Siva Vinnakota 和 Shantanu Padhye，Amazon Web Services*

## Summary
<a name="implement-saml-authentication-for-amazon-workspaces-by-using-auth0-and-aws-managed-microsoft-ad-summary"></a>

此模式探讨了如何将 Auth0 与集成 AWS Directory Service for Microsoft Active Directory ，为您的亚马逊 WorkSpaces 环境创建强大的 SAML 2.0 身份验证解决方案。它解释了如何在它们之间建立联合， AWS 服务 以启用多因素身份验证 (MFA) 和自定义登录流程等高级功能，同时保持无缝的桌面访问权限。 AWS Managed Microsoft AD无论您的团队规模如何，这种集成都有助于为组织提供灵活性和安全性。此模式提供了设置过程的步骤，因此您可以在自己的环境中实施此解决方案。

## 先决条件和限制
<a name="implement-saml-authentication-for-amazon-workspaces-by-using-auth0-and-aws-managed-microsoft-ad-prereqs"></a>

**先决条件**
+ 活跃的 AWS 账户
+ AWS Managed Microsoft AD
+ Amazon Person WorkSpaces al 中与之关联的预配置桌面 AWS Managed Microsoft AD
+ 亚马逊弹性计算云 (Amazon EC2) 实例
+ Auth0 账户

**限制**

有些 AWS 服务 并非全部可用 AWS 区域。有关区域可用性，请参阅[按区域划分的AWS 服务](https://aws.amazon.com/about-aws/global-infrastructure/regional-product-services/)。有关特定端点，请参阅[服务端点和配额](https://docs.aws.amazon.com/general/latest/gr/aws-service-information.html)页面，然后选择相应服务的链接。

## 架构
<a name="implement-saml-authentication-for-amazon-workspaces-by-using-auth0-and-aws-managed-microsoft-ad-architecture"></a>

 WorkSpaces 客户端应用程序的 SAML 2.0 身份验证过程包括五个步骤，如下图所示。这些步骤可代表典型的登录工作流。按照此模式中的说明进行操作后，您可以使用这种分布式方法进行身份验证，以帮助为用户提供结构化且安全的访问方法。

![\[WorkSpaces 客户端应用程序的 SAML 2.0 身份验证过程的工作流程。\]](http://docs.aws.amazon.com/zh_cn/prescriptive-guidance/latest/patterns/images/pattern-img/5a0f227c-c111-495b-9fde-98ae7832bb10/images/957b2a11-e898-4c4f-ae4e-c2e85bfa93a0.png)


 工作流：

1. **注册**。用户启动客户端应用程序 WorkSpaces 并输入其启用 SAML WorkSpaces 的目录的 WorkSpaces 注册码。 WorkSpaces 返回客户端应用程序的 Auth0 身份提供者 (IdP) 网址。

1. **登录**。 WorkSpaces 客户端使用 Auth0 网址重定向到用户的 Web 浏览器。 用户使用用户名和密码进行身份验证。Auth0 向客户端浏览器返回 SAML 断言。SAML 断言是一种用于断言用户身份的加密令牌。

1. **认证**。客户端浏览器将 SAML 断言发布到 AWS 登录 端点以对其进行验证。 AWS 登录 允许调用者扮演 AWS Identity and Access Management (IAM) 角色。这将返回一个包含 IAM 角色临时证书的令牌。

1. **WorkSpaces 登录**。 WorkSpaces 客户端将令牌 WorkSpaces 提供给服务端点。 WorkSpaces 将令牌交换为会话令牌，并将带有登录 URL 的会话令牌返回给 WorkSpaces 客户端。当 WorkSpaces 客户端加载登录页面时。用户名值由 SAML 响应中传递的`NameId`值填充。

1. **直播**。用户输入密码并根据 WorkSpaces 目录进行身份验证。身份验证后，将令牌 WorkSpaces 返回给客户端。客户端重定向回 WorkSpaces 服务并出示令牌。这会促成 WorkSpaces 客户端与之间的流媒体会话 WorkSpace。

**注意**  
要设置不需要密码提示的无缝单点登录体验，请参阅文档中的[基于证书的身份验证和 WorkSpaces 个人](https://docs.aws.amazon.com/workspaces/latest/adminguide/certificate-based-authentication.html)。 WorkSpaces 

## 工具
<a name="implement-saml-authentication-for-amazon-workspaces-by-using-auth0-and-aws-managed-microsoft-ad-tools"></a>

**AWS 服务**
+ [Amazon WorkSpaces](https://docs.aws.amazon.com/workspaces/latest/adminguide/amazon-workspaces.html) 是一项完全托管的虚拟桌面基础架构 (VDI) 服务，可为用户提供基于云的桌面，无需购买和部署硬件或安装复杂软件。
+ [AWS Directory Service for Microsoft Active Directory](https://docs.aws.amazon.com/directoryservice/latest/admin-guide/directory_microsoft_ad.html)允许你的目录感知工作负载和 AWS 资源使用中的 Microsoft Active Directory。 AWS 云

**其他工具**
+ [Auth0](https://auth0.com/) 是一个身份验证和授权平台，可帮助您管理对应用程序的访问权限。

## 操作说明
<a name="implement-saml-authentication-for-amazon-workspaces-by-using-auth0-and-aws-managed-microsoft-ad-epics"></a>

### 在 Auth0 中配置 Active Directory LDAP Connector
<a name="configure-the-active-directory-ldap-connector-in-auth0"></a>


| Task | 说明 | 所需技能 | 
| --- | --- | --- | 
| 使用在 Auth0 中安装活动目录 LDAP 连接器。 AWS Managed Microsoft AD | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/prescriptive-guidance/latest/patterns/implement-saml-authentication-for-amazon-workspaces-by-using-auth0-and-aws-managed-microsoft-ad.html) | 云管理员、云架构师 | 
| 在 Auth0 中创建应用程序以生成 SAML 元数据清单文件。 | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/prescriptive-guidance/latest/patterns/implement-saml-authentication-for-amazon-workspaces-by-using-auth0-and-aws-managed-microsoft-ad.html) | 云管理员、云架构师 | 

### 在 IAM 中，为 SAML 2.0 设置 IdP、角色和策略
<a name="set-up-idp-role-and-policy-for-saml-2-0-in-iam"></a>


| Task | 说明 | 所需技能 | 
| --- | --- | --- | 
| 首先，在 IAM 中创建 SAML 2.0。 | 要将 SAML 2.0 设置为 IdP，请按照 IAM 文档中[在 IAM 中创建 SAML 身份提供者](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_saml.html)中概述的步骤进行操作。 | 云管理员 | 
| 创建用于 SAML 2.0 联合身份验证的 IAM 角色和策略。 | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/prescriptive-guidance/latest/patterns/implement-saml-authentication-for-amazon-workspaces-by-using-auth0-and-aws-managed-microsoft-ad.html) | 云管理员 | 

### 在 Auth0 中配置断言
<a name="configure-assertions-in-auth0"></a>


| Task | 说明 | 所需技能 | 
| --- | --- | --- | 
| 配置 Auth0 和 SAML 断言。 | 您可以使用 Auth0 操作在 SAML 2.0 响应中配置断言。SAML 断言是一种用于断言用户身份的加密令牌。[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/prescriptive-guidance/latest/patterns/implement-saml-authentication-for-amazon-workspaces-by-using-auth0-and-aws-managed-microsoft-ad.html) WorkSpaces 个人桌面的 SAML 2.0 身份验证设置到此完成。[架构](#implement-saml-authentication-for-amazon-workspaces-by-using-auth0-and-aws-managed-microsoft-ad-architecture)部分说明了设置后的身份验证过程。 | 云管理员 | 

## 故障排除
<a name="implement-saml-authentication-for-amazon-workspaces-by-using-auth0-and-aws-managed-microsoft-ad-troubleshooting"></a>


| 问题 | 解决方案 | 
| --- | --- | 
| 中的 SAML 2.0 身份验证问题 WorkSpaces** ** | 如果您在实施 WorkSpaces 个人版 SAML 2.0 身份验证时遇到任何问题，请按照 re [AWS : Post 中关于排除 SAML 2.0 身份验证的文章](https://repost.aws/knowledge-center/workspaces-saml-authentication-issues)中概述的步骤和链接进行操作。有关在访问时调查 SAML 2.0 错误的更多信息 WorkSpaces，请参阅：[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/prescriptive-guidance/latest/patterns/implement-saml-authentication-for-amazon-workspaces-by-using-auth0-and-aws-managed-microsoft-ad.html) | 

## 相关资源
<a name="implement-saml-authentication-for-amazon-workspaces-by-using-auth0-and-aws-managed-microsoft-ad-resources"></a>
+ 为@@ [ WorkSpaces 个人设置 SAML 2.0](https://docs.aws.amazon.com/workspaces/latest/adminguide/setting-up-saml.html)（WorkSpaces 文档）
+ [Auth0 文档](https://auth0.com/docs)