From dc8e6d4c932c69e6d124518e965cdafce28bd0b6 Mon Sep 17 00:00:00 2001 From: Mirko Di Serafino Date: Fri, 7 Jun 2024 15:16:00 +0200 Subject: [PATCH 1/5] chore(cognito): exposed email_verified attribute --- packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/base.ts | 6 ++++++ .../aws-cognito/test/user-pool-idps/base.test.ts | 2 ++ 2 files changed, 8 insertions(+) diff --git a/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/base.ts b/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/base.ts index 08278947b9e04..caa517d3c2513 100644 --- a/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/base.ts +++ b/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/base.ts @@ -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 diff --git a/packages/aws-cdk-lib/aws-cognito/test/user-pool-idps/base.test.ts b/packages/aws-cdk-lib/aws-cognito/test/user-pool-idps/base.test.ts index 1d58e96c572da..a5893642260db 100644 --- a/packages/aws-cdk-lib/aws-cognito/test/user-pool-idps/base.test.ts +++ b/packages/aws-cdk-lib/aws-cognito/test/user-pool-idps/base.test.ts @@ -39,6 +39,7 @@ describe('UserPoolIdentityProvider', () => { attributeMapping: { givenName: ProviderAttribute.FACEBOOK_NAME, birthdate: ProviderAttribute.FACEBOOK_BIRTHDAY, + emailVerified: ProviderAttribute.other('email_verified'), }, }); @@ -46,6 +47,7 @@ describe('UserPoolIdentityProvider', () => { expect(idp.mapping).toStrictEqual({ given_name: 'name', birthdate: 'birthday', + email_verified: 'email_verified', }); }); From 8fdcc3bcdd848fce215eb9646006ea6ed2f0f828 Mon Sep 17 00:00:00 2001 From: Mirko Di Serafino Date: Fri, 7 Jun 2024 15:19:31 +0200 Subject: [PATCH 2/5] fix(cognito): alined test convention for files --- .../aws-cognito/test/user-pool-idps/{apple.ts => apple.test.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename packages/aws-cdk-lib/aws-cognito/test/user-pool-idps/{apple.ts => apple.test.ts} (100%) diff --git a/packages/aws-cdk-lib/aws-cognito/test/user-pool-idps/apple.ts b/packages/aws-cdk-lib/aws-cognito/test/user-pool-idps/apple.test.ts similarity index 100% rename from packages/aws-cdk-lib/aws-cognito/test/user-pool-idps/apple.ts rename to packages/aws-cdk-lib/aws-cognito/test/user-pool-idps/apple.test.ts From 447290711cbe7e4c0384226196c5ec847a41c730 Mon Sep 17 00:00:00 2001 From: Mirko Di Serafino Date: Fri, 7 Jun 2024 15:41:46 +0200 Subject: [PATCH 3/5] fix: restored file name --- .../aws-cognito/test/user-pool-idps/{apple.test.ts => apple.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename packages/aws-cdk-lib/aws-cognito/test/user-pool-idps/{apple.test.ts => apple.ts} (100%) diff --git a/packages/aws-cdk-lib/aws-cognito/test/user-pool-idps/apple.test.ts b/packages/aws-cdk-lib/aws-cognito/test/user-pool-idps/apple.ts similarity index 100% rename from packages/aws-cdk-lib/aws-cognito/test/user-pool-idps/apple.test.ts rename to packages/aws-cdk-lib/aws-cognito/test/user-pool-idps/apple.ts From ea46cb1688e2821fb61a888104ee7c2de86d6276 Mon Sep 17 00:00:00 2001 From: Mirko Di Serafino Date: Mon, 10 Jun 2024 10:18:24 +0200 Subject: [PATCH 4/5] test: added integration tests --- .../test/aws-cognito/test/integ.user-pool-idp.oidc.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.oidc.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.oidc.ts index 38488319e5e15..8d6e61d314147 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.oidc.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.oidc.ts @@ -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 @@ -27,6 +31,7 @@ new UserPoolIdentityProviderOidc(stack, 'cdk', { scopes: ['openid', 'phone'], attributeMapping: { phoneNumber: ProviderAttribute.other('phone_number'), + emailVerified: ProviderAttribute.other('email_verified'), }, }); From 792a8df8083f0caf5dc78397de880c29a8e02d44 Mon Sep 17 00:00:00 2001 From: Mirko Di Serafino Date: Mon, 10 Jun 2024 10:22:01 +0200 Subject: [PATCH 5/5] fix: restored original indentation --- .../test/aws-cognito/test/integ.user-pool-idp.oidc.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.oidc.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.oidc.ts index 8d6e61d314147..81ff8582bdf7f 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.oidc.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.oidc.ts @@ -1,9 +1,5 @@ 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