Skip to content

Commit 5de7835

Browse files
authored
feat(cognito): support emailVerified for AttributeMapping interface (#31632)
### Issue #30467 Closes #30467 ### Reason for this change For custom OpenId providers, there is no way to automatically validate email upon sign-in. Therefore, we would like to add the `email_verified` attribute to attribute mapping, but it is not present in the member definition of `AttributeMapping` interface., so we have added it in this PR. ### Description of changes Added `emailVerified` attribute to `AttributeMapping` interface. ### Description of how you validated changes Added the `email_verified` assertion to both unit and integration tests. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 34bdeca commit 5de7835

25 files changed

+129
-70
lines changed

Diff for: packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.apple.js.snapshot/cdk.out

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.apple.js.snapshot/integ-user-pool-idp-apple.assets.json

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.apple.js.snapshot/integ-user-pool-idp-apple.template.json

+11-10
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@
3434
"poolclient2623294C": {
3535
"Type": "AWS::Cognito::UserPoolClient",
3636
"Properties": {
37-
"UserPoolId": {
38-
"Ref": "pool056F3F7E"
39-
},
4037
"AllowedOAuthFlows": [
4138
"implicit",
4239
"code"
@@ -57,7 +54,10 @@
5754
"Ref": "apple9B5408AC"
5855
},
5956
"COGNITO"
60-
]
57+
],
58+
"UserPoolId": {
59+
"Ref": "pool056F3F7E"
60+
}
6161
}
6262
},
6363
"pooldomain430FA744": {
@@ -72,21 +72,22 @@
7272
"apple9B5408AC": {
7373
"Type": "AWS::Cognito::UserPoolIdentityProvider",
7474
"Properties": {
75-
"ProviderName": "SignInWithApple",
76-
"ProviderType": "SignInWithApple",
77-
"UserPoolId": {
78-
"Ref": "pool056F3F7E"
79-
},
8075
"AttributeMapping": {
8176
"family_name": "lastName",
82-
"given_name": "firstName"
77+
"given_name": "firstName",
78+
"email_verified": "email_verified"
8379
},
8480
"ProviderDetails": {
8581
"client_id": "com.amzn.cdk",
8682
"team_id": "CDKTEAMCDK",
8783
"key_id": "CDKKEYCDK1",
8884
"private_key": "PRIV_KEY_CDK",
8985
"authorize_scopes": "email name"
86+
},
87+
"ProviderName": "SignInWithApple",
88+
"ProviderType": "SignInWithApple",
89+
"UserPoolId": {
90+
"Ref": "pool056F3F7E"
9091
}
9192
}
9293
}

Diff for: packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.apple.js.snapshot/integ.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.apple.js.snapshot/manifest.json

+10-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.apple.js.snapshot/tree.json

+48-31
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.apple.ts

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ new UserPoolIdentityProviderApple(stack, 'apple', {
2323
attributeMapping: {
2424
familyName: ProviderAttribute.APPLE_LAST_NAME,
2525
givenName: ProviderAttribute.APPLE_FIRST_NAME,
26+
emailVerified: ProviderAttribute.APPLE_EMAIL_VERIFIED,
2627
},
2728
});
2829

Diff for: packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.google.js.snapshot/cdk.out

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.google.js.snapshot/integ-user-pool-idp-google.assets.json

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.google.js.snapshot/integ-user-pool-idp-google.template.json

+1
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
"given_name": "given_name",
8989
"family_name": "family_name",
9090
"email": "email",
91+
"email_verified": "email_verified",
9192
"gender": "gender",
9293
"names": "names"
9394
},

Diff for: packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.google.js.snapshot/integ.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.google.js.snapshot/manifest.json

+3-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.google.js.snapshot/tree.json

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.google.ts

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ new UserPoolIdentityProviderGoogle(stack, 'google', {
3535
givenName: ProviderAttribute.GOOGLE_GIVEN_NAME,
3636
familyName: ProviderAttribute.GOOGLE_FAMILY_NAME,
3737
email: ProviderAttribute.GOOGLE_EMAIL,
38+
emailVerified: ProviderAttribute.GOOGLE_EMAIL_VERIFIED,
3839
gender: ProviderAttribute.GOOGLE_GENDER,
3940
custom: {
4041
names: ProviderAttribute.GOOGLE_NAMES,

Diff for: packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.oidc.js.snapshot/cdk.out

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)