简体   繁体   English

具有外部 IDP (SAML) 的 AWS Cognito 用于注册后/登录操作

[英]AWS Cognito with external IDP (SAML) for Post-Signup/Signin Actions

I also need to add the created/updated user into a users-table of an RDS-database, and the described workflow does not describe such a scenario at all.我还需要将创建/更新的用户添加到 RDS 数据库的用户表中,并且所描述的工作流根本没有描述这种情况。

  • Is it possible to react to the create/update of a cognito user within this SAML-workflow, by also updating an applications database-table with the new data?是否可以通过同时使用新数据更新应用程序数据库表来响应此 SAML 工作流中认知用户的创建/更新?

-- --

In the docs of AWS Cognito in the Chapter "SAML user pool IdP authentication flow" there is following part written:在“SAML 用户池 IdP 身份验证流程”一章的 AWS Cognito 文档中,有以下部分:

6. After verifying the SAML assertion and collecting the user attributes (claims) from the assertion, 
Amazon Cognito internally creates or updates the user's profile in the user pool. 
Amazon Cognito returns OIDC tokens to the app for the now signed-in user.

see: https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-saml-idp-authentication.html请参阅: https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-saml-idp-authentication.html

this part does not seem to recognize the scenario i described in my question, and there is no link/hint to such a solution given.这部分似乎无法识别我在问题中描述的场景,并且没有给出此类解决方案的链接/提示。

In order to perform additional actions to customize the Cognito user pool workflow, you can use Lambda triggers .为了执行其他操作来自定义 Cognito 用户池工作流程,您可以使用Lambda 触发器

In your particular situation, there are triggers and triggerSource values you should look for regarding Sign Up and Sign In for federated users, as per documentation , namely:在您的特定情况下,根据文档,您应该查找有关联合用户注册和登录的触发器和 triggerSource 值,即:

  • For SignUp:注册:

    • PreSignUp_ExternalProvider this is called before the user is created in Cognito, allowing to perform some additional actions, normally validations. PreSignUp_ExternalProvider在 Cognito 中创建用户之前调用它,允许执行一些额外的操作,通常是验证。
    • PostConfirmation_ConfirmSignUp is invoked after the user has been created and confirmed in Cognito.在 Cognito 中创建并确认用户后调用PostConfirmation_ConfirmSignUp This would be where you'd create it at the RDS Database.这将是您在 RDS 数据库中创建它的地方。
  • For SignIn:对于登录:

    • PreAuthentication_Authentication similarly to PreSignUp, useful for additional validations, but for Sign In. PreAuthentication_Authentication与 PreSignUp 类似,可用于其他验证,但用于登录。
    • PostAuthentication_Authentication called after a successful authentication. PostAuthentication_Authentication在身份验证成功后调用。 This is where you would update the User at your Database.这是您在数据库中更新用户的地方。

Also keep in mind that the Updated date of the user will change at each new sign-in due to this ( source ):另请记住,用户的更新日期将因此在每次新登录时发生变化( 来源):

Amazon Cognito must be able to update your mapped user pool attributes when users sign in to your application.当用户登录到您的应用程序时,Amazon Cognito 必须能够更新映射的用户池属性。 When a user signs in through an IdP, Amazon Cognito updates the mapped attributes with the latest information from the IdP.当用户通过 IdP 登录时,Amazon Cognito 会使用来自 IdP 的最新信息更新映射的属性。 Amazon Cognito updates each mapped attribute, even if its current value already matches the latest information. Amazon Cognito 会更新每个映射的属性,即使其当前值已经与最新信息匹配。

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

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