feat(cognito): allow retrieval of UserPoolClient generated client secret#21262
feat(cognito): allow retrieval of UserPoolClient generated client secret#21262mergify[bot] merged 54 commits intoaws:mainfrom Dzhuneyt:dzhuneyt/issue-7225-userpool-secret
Conversation
…ion with `userDataCausesReplacement` (#18726) If both `addSignalOnExitCommand` _and_ `userDataCausesReplacement` are used it results in an invalid logicalId being used in the `cfn-signal` call. This is due to `addSignalOnExitCommand` getting the logicalID from `Stack.getLogicalId` which does not take into consideration logicalId overrides which `userDataCausesReplacement` uses. This updates `addSignalOnExitCommand` to use the `logicalId` of the resource which is evaluated lazily and happens after all overrides. fixes #12749 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
There was a problem hiding this comment.
I like the idea and this is a great start, but I have a few thoughts.
@pahud Could you please tag a few more community reviewers for this one?
misterjoshua
left a comment
There was a problem hiding this comment.
This looks really good. I have only a few small nitpicky comments.
I'd like to see more community feedback and perhaps some review by the CDK group, but otherwise, I'm happy with this changeset.
Thanks for your work so far!
packages/@aws-cdk/aws-cognito/test/user-pool-resource-server.integ.snapshot/manifest.json
Show resolved
Hide resolved
…com/Dzhuneyt/aws-cdk into dzhuneyt/issue-7225-userpool-secret
Pull request has been modified.
|
@TheRealAmazonKendra this should be ready for another set of eyes now. Just FYI. Thanks for the good tips above. |
TheRealAmazonKendra
left a comment
There was a problem hiding this comment.
Just a few nitpicky things and then this will be ready to go!
Co-authored-by: Kendra Neil <53584728+TheRealAmazonKendra@users.noreply.github.com>
Pull request has been modified.
✅ Branch has been successfully updated |
Pull request has been modified.
TheRealAmazonKendra
left a comment
There was a problem hiding this comment.
I've left suggestions below with the kind of testing I'm looking for. Feel free to just commit my suggestions directly. I've tested them locally and it passes.
Co-authored-by: Kendra Neil <53584728+TheRealAmazonKendra@users.noreply.github.com>
Pull request has been modified.
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
…ret (aws#21262) Consumers of the `cognito.UserPoolClient` construct currently have a way to retrieve useful information and pass that information to other pieces of infrastructure (e.g. Lambdas, ECS, Parameter Store, CfnOutput), e.g. the Client ID, which is useful for certain operations against the Cognito user pool that require a Cognito client. However, if consumers decide to configure the Client, with a pre-generated (random) Client Secret for security reasons, by passing the `generateSecret: true` prop to `cognito.UserPoolClient`, most operations to the Cognito UserPool now require the Client ID AND Client Secret, otherwise they generate the `Unable to verify secret hash for client <client-id>` error (see [AWS support article](https://aws.amazon.com/premiumsupport/knowledge-center/cognito-unable-to-verify-secret-hash/) for more info). Currently, the construct exposes no way to retrieve the Client Secret, forcing consumers to work around this by using custom resources or custom AWS SDK calls to retrieve it. This PR addresses that, by exposing a new getter method of the `UserPoolClient` class, allowing consumers to read it on demand and pass it to other pieces of infrastructure, using code like: ```ts const userPoolClient = new cognito.UserPoolClient(this, 'UserPoolClient', { userPool, generateSecret: true, }); // Allows you to pass the generated secret to other pieces of infrastructure const secret = userPoolClient.userPoolClientSecret; ``` Closes aws#7225 ---- ### All Submissions: * [X] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Consumers of the
cognito.UserPoolClientconstruct currently have a way to retrieve useful information and pass that information to other pieces of infrastructure (e.g. Lambdas, ECS, Parameter Store, CfnOutput), e.g. the Client ID, which is useful for certain operations against the Cognito user pool that require a Cognito client.However, if consumers decide to configure the Client, with a pre-generated (random) Client Secret for security reasons, by passing the
generateSecret: trueprop tocognito.UserPoolClient, most operations to the Cognito UserPool now require the Client ID AND Client Secret, otherwise they generate theUnable to verify secret hash for client <client-id>error (see AWS support article for more info).Currently, the construct exposes no way to retrieve the Client Secret, forcing consumers to work around this by using custom resources or custom AWS SDK calls to retrieve it.
This PR addresses that, by exposing a new getter method of the
UserPoolClientclass, allowing consumers to read it on demand and pass it to other pieces of infrastructure, using code like:Closes #7225
All Submissions:
Adding new Unconventional Dependencies:
New Features
yarn integto deploy the infrastructure and generate the snapshot (i.e.yarn integwithout--dry-run)?By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license