简体   繁体   English

AWS:Amazon Cognito 与 STS 和 SAML

[英]AWS: Amazon Cognito vs STS and SAML

In the official AWS documentation about Cognito, in the outline of a use case is stated that:在有关 Cognito 的官方 AWS 文档中,在用例大纲中指出:

1.In the first step your app user signs in through a user pool and receives user pool tokens after a successful authentication. 1.第一步,您的应用程序用户通过用户池登录,并在成功验证后接收用户池令牌。

2.Next, your app exchanges the user pool tokens for AWS credentials through an identity pool. 2.接下来,您的应用程序通过身份池将用户池令牌交换为 AWS 凭证。

3.Finally, your app user can then use those AWS credentials to access other AWS services such as Amazon S3 or DynamoDB. 3.最后,您的应用程序用户可以使用这些 AWS 凭证访问其他 AWS 服务,例如 Amazon S3 或 DynamoDB。

Isn't the goal of assigning "AWS Credentials" via tokens achieved via STS ?通过STS实现的令牌分配“AWS 凭证”的目标不是吗?

What exactly are the differences in scope in terms of granting access to non AWS users to AWS services (say S3 or EC2) among Cognito and STS? Cognito 和 STS 在授予非 AWS 用户访问 AWS 服务(比如 S3 或 EC2)的范围方面到底有什么区别?

The same source of documentation also states that Cognito is also good for identity federation between AWS and a third party Identity provider (such as social - eg Facebook - or an AD corporate one).相同的文档来源还指出,Cognito 也适用于 AWS 和第三方身份提供商(例如社交 - 例如 Facebook - 或 AD 公司)之间的身份联合。

Isn't this also achieved via SAML federation (ie having AWS and the IdP establishing a SAML-based trust relationship first?)这不是也可以通过 SAML 联合实现(即让 AWS 和 IdP 首先建立基于 SAML 的信任关系吗?)

Cognito User Pools, and Identity Pools, are higher-level abstractions than SAML and STS. Cognito 用户池和身份池是比 SAML 和 STS 更高级别的抽象。 Let's start with defining what SAML and STS are:让我们从定义什么是 SAML 和 STS 开始:

SAML makes single sign-on (SSO) technology possible by providing a way to authenticate a user once and then communicate that authentication to multiple applications. SAML通过提供一种对用户进行一次身份验证然后将该身份验证传递给多个应用程序的方法,使单点登录 (SSO) 技术成为可能。

STS is a web service that enables you to request temporary, limited-privilege credentials for AWS Identity and Access Management (IAM) users or for users that you authenticate STS是一项 Web 服务,可让您为 AWS Identity and Access Management (IAM) 用户或您进行身份验证的用户请求临时的、有限权限的凭证

Basically, SAML is a method of transmitting authentication tokens generated by one application to another, and STS is a method of getting authorization tokens (ie AWS credentials) from AWS.基本上,SAML 是一种将一个应用程序生成的身份验证令牌传输到另一个应用程序的方法,而 STS 是一种从 AWS 获取授权令牌(即 AWS 凭证)的方法。

Now, on the other hand, we have Cognito User and Identity Pools:另一方面,现在我们有了 Cognito 用户和身份池:

User Pools provide authentication, like SAML, but they also provide a database of users.用户池提供身份验证,如 SAML,但它们提供用户数据库。 SAML does not do this, so if you want to keep user data around, add to it, change it, etc. you need to do it yourself. SAML 不会这样做,所以如果您想保留用户数据、添加、更改等,您需要自己做。 All SAML lets you do is offload authentication of those users to another party. SAML 允许您做的就是将这些用户的身份验证卸载给另一方。 You have to write all the code to make the authentication happen, though.不过,您必须编写所有代码才能进行身份验证。

User pools can themselves use a SAML authentication provider, or do their own built-in authentication.用户池可以自己使用 SAML 身份验证提供程序,或进行自己的内置身份验证。 But in either case, you still end up with a user entity that lives in Cognito and has data associated with it.但无论哪种情况,您最终都会得到一个存在于 Cognito 中并具有与之关联的数据的用户实体。

Identity Pools provide authorization, ie the decision of what to allow a (usually authenticated, but not always) user to do.身份池提供授权,即决定允许(通常经过身份验证,但并非总是)用户可以做什么。 They do use STS in the background, to get tokens enabling specific actions, but an Identity Pool chooses based on user characteristics whether and what credentials to grant.他们确实在后台使用 STS 来获取启用特定操作的令牌,但身份池会根据用户特征选择是否授予凭据以及授予哪些凭据。 An identity pool relies on an authentication provider to determine who a user is;身份池依赖身份验证提供程序来确定用户是谁; this provider can be a user pool, or a SAML provider, too.该提供者也可以是用户池或 SAML 提供者。 An identity pool will automatically check given authentication tokens that they're valid according to the provider, and that they allow the user to get certain authorization tokens.身份池将根据提供者自动检查给定的身份验证令牌是否有效,以及它们是否允许用户获得某些授权令牌。

In summary , Cognito User Pools and Cognito Identity Pools encapsulate the functionality which you would normally need to write yourself to go from a SAML provider to a user database to a mapping of users to permissions to being able to retrieve AWS credentials for those permissions.总之,Cognito 用户池和 Cognito 身份池封装了您通常需要自己编写的功能,以便从 SAML 提供程序到用户数据库,再到将用户映射到权限,再到能够检索这些权限的 AWS 凭证。 Instead of making auth calls to a SAML provider (or implementing your own auth), implementing a user database, and then making AWS credentials for a user's privileges, they allow you to configure a user pool to use a given provider (or Cognito's own auth), point an identity pool at the user pool, and tell the identity pool what permissions members of the user pool should have.无需对 SAML 提供程序进行身份验证调用(或实现您自己的身份验证)、实现用户数据库,然后为用户权限创建 AWS 凭证,它们允许您配置用户池以使用给定的提供程序(或 Cognito 自己的身份验证) ), 将一个身份池指向用户池,并告诉身份池用户池的成员应该有什么权限。 All the rest is done in the background, for you.所有其余的都在后台为您完成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM