-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(aws-cognito): send emails with a verified domain (#19790)
When sending emails with a verified domain, the email address does not need to be verified. In that case, the identity of the SourceArn in EmailConfiguration is allowed to be set to the domain instead of the email address. closes [#19762](#19762) ---- ### All Submissions: * [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [x] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/master/INTEGRATION_TESTS.md)? * [ ] Did you use `cdk-integ` to deploy the infrastructure and generate the snapshot (i.e. `cdk-integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information
1 parent
7bd7139
commit 1d2b1d3
Showing
8 changed files
with
330 additions
and
1 deletion.
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
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
23 changes: 23 additions & 0 deletions
23
packages/@aws-cdk/aws-cognito/test/integ.user-pool-ses-email.ts
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,23 @@ | ||
import { App, CfnOutput, RemovalPolicy, Stack } from '@aws-cdk/core'; | ||
import { UserPool, UserPoolEmail } from '../lib'; | ||
|
||
|
||
const app = new App(); | ||
const stack = new Stack(app, 'integ-user-pool-signup-code'); | ||
|
||
const userpool = new UserPool(stack, 'myuserpool', { | ||
removalPolicy: RemovalPolicy.DESTROY, | ||
userPoolName: 'MyUserPool', | ||
email: UserPoolEmail.withSES({ | ||
sesRegion: 'us-east-1', | ||
fromEmail: 'noreply@example.com', | ||
replyTo: 'support@example.com', | ||
sesVerifiedDomain: 'example.com', | ||
}), | ||
}); | ||
|
||
new CfnOutput(stack, 'user-pool-id', { | ||
value: userpool.userPoolId, | ||
}); | ||
|
||
app.synth(); |
1 change: 1 addition & 0 deletions
1
packages/@aws-cdk/aws-cognito/test/user-pool-ses-email.integ.snapshot/cdk.out
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 @@ | ||
{"version":"17.0.0"} |
64 changes: 64 additions & 0 deletions
64
...cognito/test/user-pool-ses-email.integ.snapshot/integ-user-pool-signup-code.template.json
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,64 @@ | ||
{ | ||
"Resources": { | ||
"myuserpool01998219": { | ||
"Type": "AWS::Cognito::UserPool", | ||
"Properties": { | ||
"AccountRecoverySetting": { | ||
"RecoveryMechanisms": [ | ||
{ | ||
"Name": "verified_phone_number", | ||
"Priority": 1 | ||
}, | ||
{ | ||
"Name": "verified_email", | ||
"Priority": 2 | ||
} | ||
] | ||
}, | ||
"AdminCreateUserConfig": { | ||
"AllowAdminCreateUserOnly": true | ||
}, | ||
"EmailConfiguration": { | ||
"EmailSendingAccount": "DEVELOPER", | ||
"From": "noreply@example.com", | ||
"ReplyToEmailAddress": "support@example.com", | ||
"SourceArn": { | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"arn:", | ||
{ | ||
"Ref": "AWS::Partition" | ||
}, | ||
":ses:us-east-1:", | ||
{ | ||
"Ref": "AWS::AccountId" | ||
}, | ||
":identity/example.com" | ||
] | ||
] | ||
} | ||
}, | ||
"EmailVerificationMessage": "The verification code to your new account is {####}", | ||
"EmailVerificationSubject": "Verify your new account", | ||
"SmsVerificationMessage": "The verification code to your new account is {####}", | ||
"UserPoolName": "MyUserPool", | ||
"VerificationMessageTemplate": { | ||
"DefaultEmailOption": "CONFIRM_WITH_CODE", | ||
"EmailMessage": "The verification code to your new account is {####}", | ||
"EmailSubject": "Verify your new account", | ||
"SmsMessage": "The verification code to your new account is {####}" | ||
} | ||
}, | ||
"UpdateReplacePolicy": "Delete", | ||
"DeletionPolicy": "Delete" | ||
} | ||
}, | ||
"Outputs": { | ||
"userpoolid": { | ||
"Value": { | ||
"Ref": "myuserpool01998219" | ||
} | ||
} | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
packages/@aws-cdk/aws-cognito/test/user-pool-ses-email.integ.snapshot/manifest.json
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,35 @@ | ||
{ | ||
"version": "17.0.0", | ||
"artifacts": { | ||
"Tree": { | ||
"type": "cdk:tree", | ||
"properties": { | ||
"file": "tree.json" | ||
}, | ||
"metadata": {} | ||
}, | ||
"integ-user-pool-signup-code": { | ||
"type": "aws:cloudformation:stack", | ||
"environment": "aws://unknown-account/unknown-region", | ||
"properties": { | ||
"templateFile": "integ-user-pool-signup-code.template.json", | ||
"validateOnSynth": false | ||
}, | ||
"metadata": { | ||
"/integ-user-pool-signup-code/myuserpool/Resource": [ | ||
{ | ||
"type": "aws:cdk:logicalId", | ||
"data": "myuserpool01998219" | ||
} | ||
], | ||
"/integ-user-pool-signup-code/user-pool-id": [ | ||
{ | ||
"type": "aws:cdk:logicalId", | ||
"data": "userpoolid" | ||
} | ||
] | ||
}, | ||
"displayName": "integ-user-pool-signup-code" | ||
} | ||
} | ||
} |
108 changes: 108 additions & 0 deletions
108
packages/@aws-cdk/aws-cognito/test/user-pool-ses-email.integ.snapshot/tree.json
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,108 @@ | ||
{ | ||
"version": "tree-0.1", | ||
"tree": { | ||
"id": "App", | ||
"path": "", | ||
"children": { | ||
"Tree": { | ||
"id": "Tree", | ||
"path": "Tree", | ||
"constructInfo": { | ||
"fqn": "@aws-cdk/core.Construct", | ||
"version": "0.0.0" | ||
} | ||
}, | ||
"integ-user-pool-signup-code": { | ||
"id": "integ-user-pool-signup-code", | ||
"path": "integ-user-pool-signup-code", | ||
"children": { | ||
"myuserpool": { | ||
"id": "myuserpool", | ||
"path": "integ-user-pool-signup-code/myuserpool", | ||
"children": { | ||
"Resource": { | ||
"id": "Resource", | ||
"path": "integ-user-pool-signup-code/myuserpool/Resource", | ||
"attributes": { | ||
"aws:cdk:cloudformation:type": "AWS::Cognito::UserPool", | ||
"aws:cdk:cloudformation:props": { | ||
"accountRecoverySetting": { | ||
"recoveryMechanisms": [ | ||
{ | ||
"name": "verified_phone_number", | ||
"priority": 1 | ||
}, | ||
{ | ||
"name": "verified_email", | ||
"priority": 2 | ||
} | ||
] | ||
}, | ||
"adminCreateUserConfig": { | ||
"allowAdminCreateUserOnly": true | ||
}, | ||
"emailConfiguration": { | ||
"from": "noreply@example.com", | ||
"replyToEmailAddress": "support@example.com", | ||
"emailSendingAccount": "DEVELOPER", | ||
"sourceArn": { | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"arn:", | ||
{ | ||
"Ref": "AWS::Partition" | ||
}, | ||
":ses:us-east-1:", | ||
{ | ||
"Ref": "AWS::AccountId" | ||
}, | ||
":identity/example.com" | ||
] | ||
] | ||
} | ||
}, | ||
"emailVerificationMessage": "The verification code to your new account is {####}", | ||
"emailVerificationSubject": "Verify your new account", | ||
"smsVerificationMessage": "The verification code to your new account is {####}", | ||
"userPoolName": "MyUserPool", | ||
"verificationMessageTemplate": { | ||
"defaultEmailOption": "CONFIRM_WITH_CODE", | ||
"emailMessage": "The verification code to your new account is {####}", | ||
"emailSubject": "Verify your new account", | ||
"smsMessage": "The verification code to your new account is {####}" | ||
} | ||
} | ||
}, | ||
"constructInfo": { | ||
"fqn": "@aws-cdk/aws-cognito.CfnUserPool", | ||
"version": "0.0.0" | ||
} | ||
} | ||
}, | ||
"constructInfo": { | ||
"fqn": "@aws-cdk/aws-cognito.UserPool", | ||
"version": "0.0.0" | ||
} | ||
}, | ||
"user-pool-id": { | ||
"id": "user-pool-id", | ||
"path": "integ-user-pool-signup-code/user-pool-id", | ||
"constructInfo": { | ||
"fqn": "@aws-cdk/core.CfnOutput", | ||
"version": "0.0.0" | ||
} | ||
} | ||
}, | ||
"constructInfo": { | ||
"fqn": "@aws-cdk/core.Stack", | ||
"version": "0.0.0" | ||
} | ||
} | ||
}, | ||
"constructInfo": { | ||
"fqn": "@aws-cdk/core.App", | ||
"version": "0.0.0" | ||
} | ||
} | ||
} |
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