Skip to content

Commit

Permalink
Customize Amazon Cognito authentication behavior with Lambda function…
Browse files Browse the repository at this point in the history
…s workflow.

This workflow contains three sub-workflows:

* Auto confirm known users
* Auto migrate known users
* Write custom activity logs
  • Loading branch information
Laren-AWS committed Apr 25, 2024
1 parent 50c96af commit b893b7a
Show file tree
Hide file tree
Showing 56 changed files with 18,706 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .doc_gen/metadata/cloudformation_metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,20 @@ cloudformation_Hello:
- CloudFormation.dotnetv3.CloudFormationActions.HelloCloudFormation
services:
cloudformation: {DescribeStackResources}
cloudformation_DescribeStacks:
title: Get outputs from an &CFN; stack using an &AWS; SDK
title_abbrev: Get outputs from an stack
synopsis: get outputs from an &CFN; stack.
category:
languages:
Go:
versions:
- sdk_version: 2
github: gov2/workflows/user_pools_and_lambda_triggers
sdkguide:
excerpts:
- description:
snippet_tags:
- gov2.cloudformation.CloudFormationActions.complete
services:
cloudformation: {DescribeStacks}
134 changes: 134 additions & 0 deletions .doc_gen/metadata/cognito-identity-provider_metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ cognito-identity-provider_Hello:
synopsis: get started using &COG;.
category: Hello
languages:
Go:
versions:
- sdk_version: 2
github: gov2/cognito
excerpts:
- description:
snippet_tags:
- gov2.cognito-identity-provider.hello
Java:
versions:
- sdk_version: 2
Expand Down Expand Up @@ -50,6 +58,14 @@ cognito-identity-provider_ListUserPools:
- description:
snippet_tags:
- Cognito.dotnetv3.ListUserPools
Go:
versions:
- sdk_version: 2
github: gov2/cognito
excerpts:
- description:
snippet_tags:
- gov2.cognito-identity-provider.hello
Rust:
versions:
- sdk_version: 1
Expand Down Expand Up @@ -84,6 +100,15 @@ cognito-identity-provider_SignUp:
- description:
snippet_tags:
- Cognito.dotnetv3.SignUp
Go:
versions:
- sdk_version: 2
github: gov2/cognito
excerpts:
- description:
snippet_tags:
- gov2.cognito-identity-provider.CognitoActions.struct
- gov2.cognito-identity-provider.SignUp
Kotlin:
versions:
- sdk_version: 1
Expand Down Expand Up @@ -686,6 +711,15 @@ cognito-identity-provider_InitiateAuth:
- description:
snippet_tags:
- Cognito.dotnetv3.InitiateAuth
Go:
versions:
- sdk_version: 2
github: gov2/cognito
excerpts:
- description:
snippet_tags:
- gov2.cognito-identity-provider.CognitoActions.struct
- gov2.cognito-identity-provider.InitiateAuth
Python:
versions:
- sdk_version: 3
Expand Down Expand Up @@ -753,6 +787,15 @@ cognito-identity-provider_DeleteUser:
- cpp.example_code.cognito.client_configuration
- cpp.example_code.cognito.cognito_client
- cpp.example_code.cognito.delete_user
Go:
versions:
- sdk_version: 2
github: gov2/cognito
excerpts:
- description:
snippet_tags:
- gov2.cognito-identity-provider.CognitoActions.struct
- gov2.cognito-identity-provider.DeleteUser
services:
cognito-identity-provider: {DeleteUser}
cognito-identity-provider_CreateUserPool:
Expand Down Expand Up @@ -789,6 +832,97 @@ cognito-identity-provider_CreateUserPoolClientApp:
- cognito.java2.user_pool.create_user_pool_client.main
services:
cognito-identity-provider: {CreateUserPoolClient}
cognito-identity-provider_UpdateUserPool:
title: Update an &COG; user pool using an &AWS; SDK
title_abbrev: Update a user pool
synopsis: update an &COG; user pool.
category:
languages:
Go:
versions:
- sdk_version: 2
github: gov2/cognito
sdkguide:
excerpts:
- description:
snippet_tags:
- gov2.cognito-identity-provider.CognitoActions.struct
- gov2.cognito-identity-provider.UpdateUserPool
services:
cognito-identity-provider: {UpdateUserPool}
cognito-identity-provider_ForgotPassword:
title: Start &COG; forgotten password flow using an &AWS; SDK
title_abbrev: Start forgotten password flow
synopsis: start &COG; forgotten password flow.
category:
languages:
Go:
versions:
- sdk_version: 2
github: gov2/cognito
sdkguide:
excerpts:
- description:
snippet_tags:
- gov2.cognito-identity-provider.CognitoActions.struct
- gov2.cognito-identity-provider.ForgotPassword
services:
cognito-identity-provider: {ForgotPassword}
cognito-identity-provider_ConfirmForgotPassword:
title: Confirm an &COG; forgotten password using an &AWS; SDK
title_abbrev: Confirm a forgotten password
synopsis: confirm an &COG; forgotten password.
category:
languages:
Go:
versions:
- sdk_version: 2
github: gov2/cognito
sdkguide:
excerpts:
- description:
snippet_tags:
- gov2.cognito-identity-provider.CognitoActions.struct
- gov2.cognito-identity-provider.ConfirmForgotPassword
services:
cognito-identity-provider: {ConfirmForgotPassword}
cognito-identity-provider_AdminCreateUser:
title: Create an &COG; user with administrator credentials using an &AWS; SDK
title_abbrev: Create a user with administrator credentials
synopsis: create an &COG; user with administrator credentials.
category:
languages:
Go:
versions:
- sdk_version: 2
github: gov2/cognito
sdkguide:
excerpts:
- description:
snippet_tags:
- gov2.cognito-identity-provider.CognitoActions.struct
- gov2.cognito-identity-provider.AdminCreateUser
services:
cognito-identity-provider: {AdminCreateUser}
cognito-identity-provider_AdminSetUserPassword:
title: Set the password for an &COG; user with administrator credentials using an &AWS; SDK
title_abbrev: Set the password for a user with administrator credentials
synopsis: set the password for an &COG; user with administrator credentials.
category:
languages:
Go:
versions:
- sdk_version: 2
github: gov2/cognito
sdkguide:
excerpts:
- description:
snippet_tags:
- gov2.cognito-identity-provider.CognitoActions.struct
- gov2.cognito-identity-provider.AdminSetUserPassword
services:
cognito-identity-provider: {AdminSetUserPassword}

cognito-identity-provider_Scenario_SignUpUserWithMfa:
title: Sign up a user with an &COG; user pool that requires MFA using an &AWS; SDK
title_abbrev: Sign up a user with a user pool that requires MFA
Expand Down
138 changes: 138 additions & 0 deletions .doc_gen/metadata/cross_metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -812,3 +812,141 @@ cross_ServerlessS3DataTransformation:
services:
s3:
lambda:
cross_CognitoAutoConfirmUser:
title: Automatically confirm known &COG; users with a &LAM; function using an &AWS; SDK
title_abbrev: Automatically confirm known users with a &LAM; function
synopsis: automatically confirm known &COG; users with a &LAM; function.
synopsis_list:
- Configure a user pool to call a &LAM; function for the <code>PreSignUp</code> trigger.
- Signs up a user with &COG;.
- The &LAM; function scans an &DDB; table and automatically confirms known users.
- Sign in as the new user, then clean up resources.
category: Scenarios
languages:
Go:
versions:
- sdk_version: 2
github: gov2/workflows/user_pools_and_lambda_triggers
sdkguide:
excerpts:
- description: Run an interactive scenario at a command prompt.
snippet_tags:
- gov2.workflows.PoolsAndTriggers.AutoConfirm
- description: Handle the <code>PreSignUp</code> trigger with a &LAM; function.
snippet_tags:
- gov2.lambda.AutoConfirmHandler
- description: Create a struct that performs common tasks.
snippet_tags:
- gov2.workflows.PoolsAndTriggers.ScenarioHelper
- description: Create a struct that wraps &COG; actions.
snippet_tags:
- gov2.cognito-identity-provider.CognitoActions.complete
- description: Create a struct that wraps &DDB; actions.
snippet_tags:
- gov2.dynamodb.DynamoActions.complete
- description: Create a struct that wraps &CWL; actions.
snippet_tags:
- gov2.cloudwatch-logs.CloudWatchLogsActions.complete
- description: Create a struct that wraps &CFN; actions.
snippet_tags:
- gov2.cloudformation.CloudFormationActions.complete
- description: Clean up resources.
snippet_tags:
- gov2.cognito-identity-provider.Resources.complete
services:
cognito-identity-provider: {
UpdateUserPool, SignUp, InitiateAuth, DeleteUser}
lambda: {}
cross_CognitoAutoMigrateUser:
title: Automatically migrate known &COG; users with a &LAM; function using an &AWS; SDK
title_abbrev: Automatically migrate known users with a &LAM; function
synopsis: automatically migrate known &COG; users with a &LAM; function.
synopsis_list:
- Configure a user pool to call a &LAM; function for the <code>MigrateUser</code> trigger.
- Sign in to &COG; with a username and email that is not in the user pool.
- The &LAM; function scans an &DDB; table and automatically migrates known users to the user pool.
- Perform the forgot password flow to reset the password for the migrated user.
- Sign in as the new user, then clean up resources.
category: Scenarios
languages:
Go:
versions:
- sdk_version: 2
github: gov2/workflows/user_pools_and_lambda_triggers
sdkguide:
excerpts:
- description: Run an interactive scenario at a command prompt.
snippet_tags:
- gov2.workflows.PoolsAndTriggers.MigrateUser
- description: Handle the <code>MigrateUser</code> trigger with a &LAM; function.
snippet_tags:
- gov2.lambda.MigrateUserHandler
- description: Create a struct that performs common tasks.
snippet_tags:
- gov2.workflows.PoolsAndTriggers.ScenarioHelper
- description: Create a struct that wraps &COG; actions.
snippet_tags:
- gov2.cognito-identity-provider.CognitoActions.complete
- description: Create a struct that wraps &DDB; actions.
snippet_tags:
- gov2.dynamodb.DynamoActions.complete
- description: Create a struct that wraps &CWL; actions.
snippet_tags:
- gov2.cloudwatch-logs.CloudWatchLogsActions.complete
- description: Create a struct that wraps &CFN; actions.
snippet_tags:
- gov2.cloudformation.CloudFormationActions.complete
- description: Clean up resources.
snippet_tags:
- gov2.cognito-identity-provider.Resources.complete
services:
cognito-identity-provider: {
UpdateUserPool, SignUp, InitiateAuth, ForgotPassword, ConfirmForgotPassword, DeleteUser}
lambda: {}
cross_CognitoCustomActivityLog:
title: Write custom activity data with a &LAM; function when an &COG; user is authenticated using an &AWS; SDK
title_abbrev: Write custom activity data with a &LAM; function when a user is authenticated
synopsis: write custom activity data with a &LAM; function when an &COG; user is authenticated.
synopsis_list:
- Use administrator functions to add a user to a user pool.
- Configure a user pool to call a &LAM; function for the <code>PostAuthentication</code> trigger.
- Sign the new user in to &COG;.
- An &LAM; function writes custom information to &CWL; and to an &DDB; table.
- Get and display custom data from the &DDB; table, then clean up resources.
category: Scenarios
languages:
Go:
versions:
- sdk_version: 2
github: gov2/workflows/user_pools_and_lambda_triggers
sdkguide:
excerpts:
- description: Run an interactive scenario at a command prompt.
snippet_tags:
- gov2.workflows.PoolsAndTriggers.ActivityLog
- description: Handle the <code>PostAuthentication</code> trigger with a &LAM; function.
snippet_tags:
- gov2.lambda.ActivityLogHandler
- description: Create a struct that performs common tasks.
snippet_tags:
- gov2.workflows.PoolsAndTriggers.ScenarioHelper
- description: Create a struct that wraps &COG; actions.
snippet_tags:
- gov2.cognito-identity-provider.CognitoActions.complete
- description: Create a struct that wraps &DDB; actions.
snippet_tags:
- gov2.dynamodb.DynamoActions.complete
- description: Create a struct that wraps &CWL; actions.
snippet_tags:
- gov2.cloudwatch-logs.CloudWatchLogsActions.complete
- description: Create a struct that wraps &CFN; actions.
snippet_tags:
- gov2.cloudformation.CloudFormationActions.complete
- description: Clean up resources.
snippet_tags:
- gov2.cognito-identity-provider.Resources.complete
services:
cognito-identity-provider: {
UpdateUserPool, InitiateAuth, ForgotPassword, ConfirmForgotPassword, DeleteUser,
AdminCreateUser, AdminSetUserPassword}
lambda: {}
3 changes: 3 additions & 0 deletions .tools/readmes/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
"base_folder": "gov2",
"service_folder": 'gov2/{{service["name"]}}',
"sdk_api_ref": 'https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/{{service["name"]}}',
"service_folder_overrides": {
"cognito-identity-provider": "gov2/cognito",
},
},
},
"Java": {
Expand Down
Loading

0 comments on commit b893b7a

Please sign in to comment.