squidfunk/terraform-aws-cognito-auth — a security tool — sits at 298 GitHub stars in the Security space. [UNMAINTAINED] Serverless Authentication as a Service (AaaS) provider built on top of AWS Cognito
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
⚠️ UNMAINTAINED: I'm lacking the time to keep this project updated, which is
why this project will not receive any further updates. Use it at your own
risk. Issues have been disabled.
Terraform AWS Cognito Auth
Add authentication to your Single Page Application (SPA) within minutes and
take full control of the authentication flow including customizable email
templates and a beautiful default UI. See the live demo.
A Terraform module to setup a serverless and easily customizable Authentication
as a Service (AaaS) provider in front of API Gateway using AWS Cognito User
Pools.
Features
Authentication using email and password or refresh token
Registration, password reset and verification
Completely customizable transactional emails
Optional multi-part default email templates (see screenshots)
Optional beautiful and mobile-friendly default UI (see screenshots)
Federated identities using Cognito Identity Pools and User Pools
A+ security rating on Mozilla Observatory (CSP, HSTS, etc.)
Excessively tested with automated unit and acceptance tests
Serverless, extremely scalable and cost effective
However, there are some limitations
Architecture
This module creates a REST API using AWS API Gateway, Lambda and Cognito User
Pools to enable registration, authentication and account recovery without the
necessity for the implementation of complex OAuth authentication flows. It was
originally inspired by LambdAuth but uses User Pools in favor of Identity
Pools because exposing (even temporary) AWS credentials is a security threat.
Account registration and recovery circumvent Cognito's default verification
logic and emit verification codes to an SNS topic which can be hooked up to a
Lambda function handling delivery via SES using default multi-part email
templates. This behavior is optional and can be customized by implementing a
custom Lambda function handling email delivery. Furthermore, a beautiful and
mobile-friendly default UI can be deployed to a custom subdomain within
your hosted zone.
Cost
AWS Cognito is free for up to 50.000 monthly active users. After that,
pricing starts at $ 0,0055 per monthly active user. Additional cost will be
attributed to AWS Lambda, API Gateway and CloudFront but it should be very
reasonable compared to what AaaS providers like Auth0 charge. While this module
does not provide all features offered by other providers, it should be quite
sufficient for securing a Single Page Application.
Usage
Add the following module to your Terraform configuration and apply it:
All resources are prefixed with the value specified as namespace. If the S3
bucket name (see below) is not explicitly set, it's set to the given namespace
which means there must not already exist an S3 bucket with the same name. This
is a common source of error.
The cognito_identity_pool_provider should match the domain name under which
the authentication provider should be deployed, i.e. it should be equal to
app_domain. Also note that SES is sandboxed by default, so every email address
needs to be verified for delivery. Contact AWS to exit sandboxed mode for
production use.
Also see the example configuration and the live demo.
Implies: app_hosted_zone_id, app_certificate_arn and app_domain
Default: ""
bucket
Description: S3 bucket name to store static files
Default: "${var.namespace}" (equal to namespace)
Email delivery
ses_sender_address
Description: SES sender email address
Default: ""
Example
Let's say we want to secure an application hosted on admin.example.com using
the default UI. First, add the following lines to your Terraform configuration
and apply it:
Now, when the user visits admin.example.com/dashboard, the initial API request
should detect a 401 Unauthorized response for an invalid or expired identity
token and redirect to the default UI:
https://login.example.com/?redirect=dashboard
After successful authentication, the default UI will redirect to the URL
specified in app_origin appending the path part specified in the redirect
parameter and the identity token in an URI fragment:
Then, after parsing the URI fragment and extracting the token, the application
can repeat the request including the identity token as an authorization header:
Authorization: Bearer <token>
If the user checks the Remember me checkbox during the authentication
process, a refresh token which is valid for 30 days is issued and sent to the
client as a secure HTTP-only cookie. When the access token expires after 1 hour,
the client is again redirected to the default UI which will immediately perform
a password-less authentication using the refresh token.
To sign out, the application must redirect the user to the following URL:
https://login.example.com/leave
This will invalidate all tokens including the refresh token stored in the
secure HTTP-only cookie.
Demo
Live demo
A live demo of this project can be found here. Please note that emails
are configured to remain undelivered due to security reasons. If you want to
try authentication, you may use the following credentials:
The target domain is localhost:8000, so you can start a local development
server on that port in order to receive the identity token after a successful
authentication attempt.
Screenshots
Default UI
Emails
Limitations
By default, AWS Cognito does only allow minor customizations of the whole
authentication flow - specifically multi-part emails are not supported; welcome
to the 21st century. To work around these restrictions registration and password
reset were decoupled using the Cognito Identity Service Provider admin APIs.
Verification is implemented with custom verification codes and email delivery.
License
MIT License
Copyright (c) 2018-2019 Martin Donath
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
Does squidfunk/terraform-aws-cognito-auth have a project website?
No homepage URL was recorded for squidfunk/terraform-aws-cognito-auth in TopGit's last sync. The README tab above frequently contains screenshots and demo links, or check the repository description on GitHub.
Is squidfunk/terraform-aws-cognito-auth open source?
Yes — squidfunk/terraform-aws-cognito-auth ships under the MIT license, which makes its source code freely readable (and, depending on license terms, forkable and reusable). Source: github.com/squidfunk/terraform-aws-cognito-auth.
What else is in the Security space?
squidfunk/terraform-aws-cognito-auth is tracked by TopGit under the Security category, alongside 7 GitHub-tagged topics. Trending and Topics pages list peer repositories of comparable stars and language.
What is squidfunk/terraform-aws-cognito-auth?
squidfunk/terraform-aws-cognito-auth (squidfunk/terraform-aws-cognito-auth) is a TypeScript project on GitHub. From the project's own README: [UNMAINTAINED] Serverless Authentication as a Service (AaaS) provider built on top of AWS Cognito
What license does squidfunk/terraform-aws-cognito-auth use?
squidfunk/terraform-aws-cognito-auth is released under the MIT license. Always verify the LICENSE file directly on GitHub for the authoritative terms — license strings can be edited out of sync with a project's actual stance.
Where do I read more about squidfunk/terraform-aws-cognito-auth?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/squidfunk/terraform-aws-cognito-auth is the definitive source.
Why is squidfunk/terraform-aws-cognito-auth categorized under Security?
TopGit places squidfunk/terraform-aws-cognito-auth in the Security category based on its GitHub topics and description (tagged: "aaas", "authentication", "aws"). Categories are assigned from real repository metadata, not editorial guesswork.
Read full README in the tab above.
Want a second opinion on terraform-aws-cognito-auth?
Ask an AI that can read this page — one click and you get its take on terraform-aws-cognito-auth.