Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cognito): support emailVerified for AttributeMapping interface #31632

Merged
merged 12 commits into from
Oct 17, 2024

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@
"Type": "AWS::Cognito::UserPoolIdentityProvider",
"Properties": {
"AttributeMapping": {
"phone_number": "phone_number"
"phone_number": "phone_number",
"email_verified": "email_verified"
},
"ProviderDetails": {
"client_id": "client-id",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ new UserPoolIdentityProviderOidc(stack, 'cdk', {
scopes: ['openid', 'phone'],
attributeMapping: {
phoneNumber: ProviderAttribute.other('phone_number'),
emailVerified: ProviderAttribute.other('email_verified'),
},
});

Expand Down
6 changes: 6 additions & 0 deletions packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ export interface AttributeMapping {
*/
readonly email?: ProviderAttribute;

/**
* The user's e-mail address is verification.
* @default - not mapped
*/
readonly emailVerified?: ProviderAttribute;

/**
* The surname or last name of user.
* @default - not mapped
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@ describe('UserPoolIdentityProvider', () => {
attributeMapping: {
givenName: ProviderAttribute.FACEBOOK_NAME,
birthdate: ProviderAttribute.FACEBOOK_BIRTHDAY,
emailVerified: ProviderAttribute.other('email_verified'),
},
});

// THEN
expect(idp.mapping).toStrictEqual({
given_name: 'name',
birthdate: 'birthday',
email_verified: 'email_verified',
});
});

Expand Down
Loading