From 7ebc8de8c10f59ef6cc1f43e688599a5c316f234 Mon Sep 17 00:00:00 2001 From: Leonardo Gama Date: Tue, 10 Sep 2024 11:35:55 -0700 Subject: [PATCH 1/4] Update integ test to check for multiple RoleAttachments --- .../test/integ.identitypool.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/packages/@aws-cdk/aws-cognito-identitypool-alpha/test/integ.identitypool.ts b/packages/@aws-cdk/aws-cognito-identitypool-alpha/test/integ.identitypool.ts index e2d1ff3b4528c..e56d0c47bde70 100644 --- a/packages/@aws-cdk/aws-cognito-identitypool-alpha/test/integ.identitypool.ts +++ b/packages/@aws-cdk/aws-cognito-identitypool-alpha/test/integ.identitypool.ts @@ -19,6 +19,7 @@ import { import { UserPoolAuthenticationProvider, } from '../lib/identitypool-user-pool-authentication-provider'; +import { IdentityPoolRoleAttachment } from '../lib'; const app = new App(); const stack = new Stack(app, 'integ-identitypool'); @@ -69,6 +70,19 @@ const idPool = new IdentityPool(stack, 'identitypool', { allowClassicFlow: true, identityPoolName: 'my-id-pool', }); +idPool.addRoleMappings( + { + mappingKey: 'myKey', + providerUrl: IdentityPoolProviderUrl.userPool(userPool, client), + rules: [ + { + claim: 'myClaim', + claimValue: 'myValue', + mappedRole: idPool.authenticatedRole, + }, + ], + } +); idPool.authenticatedRole.addToPrincipalPolicy(new PolicyStatement({ effect: Effect.ALLOW, actions: ['dynamodb:*'], @@ -80,4 +94,7 @@ idPool.unauthenticatedRole.addToPrincipalPolicy(new PolicyStatement({ resources: ['*'], })); idPool.addUserPoolAuthentication(new UserPoolAuthenticationProvider({ userPool: otherPool })); +new IdentityPoolRoleAttachment(stack, 'RoleAttachment', { + identityPool: idPool, +}); app.synth(); From e1e453839e303a477afa426c3e2657a0f07747bc Mon Sep 17 00:00:00 2001 From: Leonardo Gama Date: Tue, 1 Oct 2024 09:20:52 -0700 Subject: [PATCH 2/4] Rebase with main --- .../test/integ.identitypool.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/packages/@aws-cdk/aws-cognito-identitypool-alpha/test/integ.identitypool.ts b/packages/@aws-cdk/aws-cognito-identitypool-alpha/test/integ.identitypool.ts index 26466161d77b8..6736f98b45e09 100644 --- a/packages/@aws-cdk/aws-cognito-identitypool-alpha/test/integ.identitypool.ts +++ b/packages/@aws-cdk/aws-cognito-identitypool-alpha/test/integ.identitypool.ts @@ -3,6 +3,7 @@ import { Effect, PolicyStatement } from 'aws-cdk-lib/aws-iam'; import { App, SecretValue, Stack } from 'aws-cdk-lib'; import { IdentityPool, IdentityPoolProviderUrl } from '../lib/identitypool'; import { UserPoolAuthenticationProvider } from '../lib/identitypool-user-pool-authentication-provider'; +import { IdentityPoolRoleAttachment } from '../lib/identitypool-role-attachment'; const app = new App(); const stack = new Stack(app, 'integ-identitypool'); @@ -63,6 +64,19 @@ const idPool = new IdentityPool(stack, 'identitypool', { allowClassicFlow: true, identityPoolName: 'my-id-pool', }); +idPool.addRoleMappings( + { + mappingKey: 'myKey', + providerUrl: IdentityPoolProviderUrl.userPool(userPool, client), + rules: [ + { + claim: 'myClaim', + claimValue: 'myValue', + mappedRole: idPool.authenticatedRole, + }, + ], + } +); idPool.authenticatedRole.addToPrincipalPolicy(new PolicyStatement({ effect: Effect.ALLOW, actions: ['dynamodb:*'], @@ -74,4 +88,7 @@ idPool.unauthenticatedRole.addToPrincipalPolicy(new PolicyStatement({ resources: ['*'], })); idPool.addUserPoolAuthentication(new UserPoolAuthenticationProvider({ userPool: otherPool })); +new IdentityPoolRoleAttachment(stack, 'RoleAttachment', { + identityPool: idPool, +}); app.synth(); From 13dc7abc77ef22ca2a2205193910fb9d4056476a Mon Sep 17 00:00:00 2001 From: Leonardo Gama Date: Tue, 22 Oct 2024 13:15:06 -0700 Subject: [PATCH 3/4] :rocket: Houston prepare for launch --- .../aws-cognito-identitypool-alpha/README.md | 22 +++++++++---------- .../package.json | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/@aws-cdk/aws-cognito-identitypool-alpha/README.md b/packages/@aws-cdk/aws-cognito-identitypool-alpha/README.md index 0d1953fe62fe5..a188ce4f0cd36 100644 --- a/packages/@aws-cdk/aws-cognito-identitypool-alpha/README.md +++ b/packages/@aws-cdk/aws-cognito-identitypool-alpha/README.md @@ -1,25 +1,25 @@ # Amazon Cognito Identity Pool Construct Library - -> **Identity Pools are in a separate module while the API is being stabilized. Once we stabilize the module, they will** -**be included into the stable [aws-cognito](../aws-cognito) library. Please provide feedback on this experience by** -**creating an [issue here](https://github.com/aws/aws-cdk/issues/new/choose)** - --- -![cdk-constructs: Experimental](https://img.shields.io/badge/cdk--constructs-experimental-important.svg?style=for-the-badge) +![cdk-constructs: Developer Preview](https://img.shields.io/badge/cdk--constructs-developer--preview-informational.svg?style=for-the-badge) -> The APIs of higher level constructs in this module are experimental and under active development. -> They are subject to non-backward compatible changes or removal in any future version. These are -> not subject to the [Semantic Versioning](https://semver.org/) model and breaking changes will be -> announced in the release notes. This means that while you may use them, you may need to update -> your source code when upgrading to a newer version of this package. +> The APIs of higher level constructs in this module are in **developer preview** before they +> become stable. We will only make breaking changes to address unforeseen API issues. Therefore, +> these APIs are not subject to [Semantic Versioning](https://semver.org/), and breaking changes +> will be announced in release notes. This means that while you may use them, you may need to +> update your source code when upgrading to a newer version of this package. --- + +> **Identity Pools are in a separate module while the API is being stabilized. Once we stabilize the module, they will** +**be included into the stable [aws-cognito](../aws-cognito) library. Please provide feedback on this experience by** +**creating an [issue here](https://github.com/aws/aws-cdk/issues/new/choose)** + [Amazon Cognito Identity Pools](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-identity.html) enable you to grant your users access to other AWS services. Identity Pools are one of the two main components of [Amazon Cognito](https://docs.aws.amazon.com/cognito/latest/developerguide/what-is-amazon-cognito.html), which provides authentication, authorization, and diff --git a/packages/@aws-cdk/aws-cognito-identitypool-alpha/package.json b/packages/@aws-cdk/aws-cognito-identitypool-alpha/package.json index c1279b90a11ab..44edd140bd4c0 100644 --- a/packages/@aws-cdk/aws-cognito-identitypool-alpha/package.json +++ b/packages/@aws-cdk/aws-cognito-identitypool-alpha/package.json @@ -99,7 +99,7 @@ "node": ">= 14.15.0" }, "stability": "experimental", - "maturity": "experimental", + "maturity": "developer-preview", "awscdkio": { "announce": false }, From 8d2d53c08d9c3d98dc20eeda253e1195ea5b0b60 Mon Sep 17 00:00:00 2001 From: Leonardo Gama Date: Tue, 22 Oct 2024 14:09:20 -0700 Subject: [PATCH 4/4] oops that wasnt supposed to be there --- .../test/integ.identitypool.ts | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/packages/@aws-cdk/aws-cognito-identitypool-alpha/test/integ.identitypool.ts b/packages/@aws-cdk/aws-cognito-identitypool-alpha/test/integ.identitypool.ts index 6736f98b45e09..26466161d77b8 100644 --- a/packages/@aws-cdk/aws-cognito-identitypool-alpha/test/integ.identitypool.ts +++ b/packages/@aws-cdk/aws-cognito-identitypool-alpha/test/integ.identitypool.ts @@ -3,7 +3,6 @@ import { Effect, PolicyStatement } from 'aws-cdk-lib/aws-iam'; import { App, SecretValue, Stack } from 'aws-cdk-lib'; import { IdentityPool, IdentityPoolProviderUrl } from '../lib/identitypool'; import { UserPoolAuthenticationProvider } from '../lib/identitypool-user-pool-authentication-provider'; -import { IdentityPoolRoleAttachment } from '../lib/identitypool-role-attachment'; const app = new App(); const stack = new Stack(app, 'integ-identitypool'); @@ -64,19 +63,6 @@ const idPool = new IdentityPool(stack, 'identitypool', { allowClassicFlow: true, identityPoolName: 'my-id-pool', }); -idPool.addRoleMappings( - { - mappingKey: 'myKey', - providerUrl: IdentityPoolProviderUrl.userPool(userPool, client), - rules: [ - { - claim: 'myClaim', - claimValue: 'myValue', - mappedRole: idPool.authenticatedRole, - }, - ], - } -); idPool.authenticatedRole.addToPrincipalPolicy(new PolicyStatement({ effect: Effect.ALLOW, actions: ['dynamodb:*'], @@ -88,7 +74,4 @@ idPool.unauthenticatedRole.addToPrincipalPolicy(new PolicyStatement({ resources: ['*'], })); idPool.addUserPoolAuthentication(new UserPoolAuthenticationProvider({ userPool: otherPool })); -new IdentityPoolRoleAttachment(stack, 'RoleAttachment', { - identityPool: idPool, -}); app.synth();