-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Manually update template to 7fcff11e1ebcddaeaa3c73a5f273acb4bd551106
- Loading branch information
1 parent
befab76
commit fdcebad
Showing
18 changed files
with
404 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
4d6c144a080edf19d5711d7a0a5cc7ac68d20fa2 | ||
7fcff11e1ebcddaeaa3c73a5f273acb4bd551106 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Identity provider configuration. | ||
# If the notification service is configured, the identity provider will use the | ||
# SES-verified email to send notifications. | ||
locals { | ||
# If your application should redirect users, after successful authentication, to a | ||
# page other than the homepage, specify the path fragment here. | ||
# Example: "profile" | ||
# Docs: https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-client-apps.html | ||
callback_url_path = "" | ||
|
||
# If your application should redirect users, after signing out, to a page other than | ||
# the homepage, specify the path fragment here. | ||
# Example: "logout" | ||
# Docs: https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-client-apps.html | ||
logout_url_path = "" | ||
|
||
identity_provider_config = var.enable_identity_provider ? { | ||
identity_provider_name = "${local.prefix}${var.app_name}-${var.environment}" | ||
|
||
password_policy = { | ||
password_minimum_length = 12 | ||
temporary_password_validity_days = 7 | ||
} | ||
|
||
# Optionally configure email template for resetting a password. | ||
# Set any attribute to a non-null value to override AWS Cognito defaults. | ||
# Docs: https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pool-settings-message-customizations.html | ||
verification_email = { | ||
verification_email_message = null | ||
verification_email_subject = null | ||
} | ||
|
||
# Do not modify this block directly. | ||
client = { | ||
callback_urls = concat( | ||
var.domain_name != null ? ["https://${var.domain_name}/${local.callback_url_path}"] : [], | ||
var.extra_identity_provider_callback_urls | ||
) | ||
logout_urls = concat( | ||
var.domain_name != null ? ["https://${var.domain_name}/${local.logout_url_path}"] : [], | ||
var.extra_identity_provider_logout_urls | ||
) | ||
} | ||
} : null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Notifications configuration | ||
locals { | ||
notifications_config = var.enable_notifications ? { | ||
# Set to an SES-verified email address to be used when sending emails. | ||
# Docs: https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-email.html | ||
sender_email = null | ||
|
||
# Configure the name that users see in the "From" section of their inbox, so that it's | ||
# clearer who the email is from. | ||
sender_display_name = null | ||
|
||
# Configure the REPLY-TO email address if it should be different from the sender. | ||
# Note: Only used by the identity-provider service. | ||
reply_to_email = null | ||
} : null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
data "aws_caller_identity" "current" {} | ||
data "aws_region" "current" {} | ||
|
||
resource "aws_iam_policy" "cognito_access" { | ||
name = "${var.name}-cognito-access" | ||
policy = data.aws_iam_policy_document.cognito_access.json | ||
} | ||
|
||
data "aws_iam_policy_document" "cognito_access" { | ||
statement { | ||
actions = ["cognito-idp:*"] | ||
effect = "Allow" | ||
resources = ["arn:aws:cognito-idp:${data.aws_region.current.name}:${data.aws_caller_identity.current.id}:userpool/${var.cognito_user_pool_id}"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
resource "aws_cognito_user_pool_client" "client" { | ||
name = var.name | ||
user_pool_id = var.cognito_user_pool_id | ||
|
||
callback_urls = var.callback_urls | ||
logout_urls = var.logout_urls | ||
supported_identity_providers = ["COGNITO"] | ||
refresh_token_validity = 1 | ||
access_token_validity = 60 | ||
id_token_validity = 60 | ||
token_validity_units { | ||
refresh_token = "days" | ||
access_token = "minutes" | ||
id_token = "minutes" | ||
} | ||
|
||
generate_secret = true | ||
allowed_oauth_flows_user_pool_client = true | ||
allowed_oauth_flows = ["code"] | ||
allowed_oauth_scopes = ["phone", "email", "openid", "profile"] | ||
explicit_auth_flows = ["ALLOW_ADMIN_USER_PASSWORD_AUTH", "ALLOW_REFRESH_TOKEN_AUTH"] | ||
|
||
# Avoid security issue where error messages indicate when a user doesn't exist | ||
prevent_user_existence_errors = "ENABLED" | ||
|
||
enable_token_revocation = true | ||
enable_propagate_additional_user_context_data = false | ||
|
||
read_attributes = ["email", "email_verified", "phone_number", "phone_number_verified", "updated_at"] | ||
write_attributes = ["email", "updated_at", "phone_number"] | ||
} | ||
|
||
resource "aws_ssm_parameter" "client_secret" { | ||
name = "/${var.name}/identity-provider/client-secret" | ||
type = "SecureString" | ||
value = aws_cognito_user_pool_client.client.client_secret | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
output "access_policy_arn" { | ||
value = aws_iam_policy.cognito_access.arn | ||
} | ||
|
||
output "client_id" { | ||
description = "The ID of the user pool client" | ||
value = aws_cognito_user_pool_client.client.id | ||
} | ||
|
||
output "client_secret_arn" { | ||
description = "The arn for the SSM parameter storing the user pool client secret" | ||
value = aws_ssm_parameter.client_secret.arn | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
variable "callback_urls" { | ||
type = list(string) | ||
description = "The URL(s) that the identity provider will redirect to after a successful login" | ||
default = [] | ||
} | ||
|
||
variable "cognito_user_pool_id" { | ||
type = string | ||
description = "The ID of the user pool that the client will be associated with" | ||
} | ||
|
||
variable "logout_urls" { | ||
type = list(string) | ||
description = "The URL that the identity provider will redirect to after a successful logout" | ||
default = [] | ||
} | ||
|
||
variable "name" { | ||
type = string | ||
description = "Name of the application or service that will act as a client to the identity provider" | ||
} |
Oops, something went wrong.
fdcebad
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverage report for
app
Test suite run success
16 tests passing in 5 suites.
Report generated by 🧪jest coverage report action from fdcebad