single-sign-onamazon-cognitoidp

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.

--

In the docs of AWS Cognito in the Chapter "SAML user pool IdP authentication flow" there is following part written:

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

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.


Solution

  • In order to perform additional actions to customize the Cognito user pool workflow, you can use Lambda triggers.

    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:

    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. When a user signs in through an IdP, Amazon Cognito updates the mapped attributes with the latest information from the IdP. Amazon Cognito updates each mapped attribute, even if its current value already matches the latest information.