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 attribute mapping #30482

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should update the related snapshots file as well (here and here). Otherwise, the build will keep failing.

Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { App, CfnOutput, RemovalPolicy, Stack } from 'aws-cdk-lib';
import { ProviderAttribute, UserPool, UserPoolIdentityProviderOidc } from 'aws-cdk-lib/aws-cognito';
import {
ProviderAttribute,
UserPool,
UserPoolIdentityProviderOidc,
} from 'aws-cdk-lib/aws-cognito';

/*
* Stack verification steps
Expand Down Expand Up @@ -27,6 +31,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