Skip to content

Authenticate your users through Cognito, Lambda and API Gateway. The script will set a local cookie in the browser and prompt for reauthentication by the user if needed.

License

Notifications You must be signed in to change notification settings

marekq/serverless-cognito

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

serverless-cognito

Authenticate your users through Cognito, Lambda, API Gateway and DynamoDB. The build.sh script will set a local cookie in the browser and prompt for reauthentication by the user if needed. A simple web UI is provided which allows users to register, login, logout, see their profile and see all users.

The cookies are stored in a DynamoDB table that is part of the deployment. All user accounts are safely stored using a Cognito user pool. The Lambda function handles authentication, authorization and renders the HTML output. A second DynamoDB table is used to store the weblogs from user visits.

alt text

You can easily deploy the solution using the Serverless Application Repository.

Installation

There are two ways to install;

  1. You can use the Serverless Application Repository to easily deploy the application in less than 2 minutes. Check the 'resources' tab under CloudFormation to find the login URL of your application.

  2. Run 'build.sh' in the local directory to start a deploy using the SAM CLI.

Once you want to remove the service, simply delete the CloudFormation stack in your AWS account.

Roadmap (open to new suggestions)

  • Add change password functionality for users.
  • Add email or SMS validation for new accounts.
  • Handle authentication using a custom authorizer in API Gateway.
  • Add diagnostic pages (amount of users, last logins, etc.)
  • Add a fully functional profile with some user data.
  • Increase cookie security (better random generation and secure storage in browser).
  • Set TTL of 3 days for cookies set in browser.
  • Add fully functional login/logout.

Contact

In case of questions or bugs, please raise an issue or reach out to @marekq!

About

Authenticate your users through Cognito, Lambda and API Gateway. The script will set a local cookie in the browser and prompt for reauthentication by the user if needed.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published