-
Notifications
You must be signed in to change notification settings - Fork 4k
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): import an existing user pool client #7091
Conversation
Include other clean up around awslint exclusions and CloudFormation resource attributes. BREAKING CHANGE: `UserPoolClient` construct no longer has the property `userPoolClientClientSecret`. The functionality to retrieve the client secret never existed in CloudFormation, so this property was not working in the first place. * **cognito:** The `userPoolClientName` property on the `UserPoolClient` construct may now return `undefined`. This property was previously incorrectly configured and was returning a not-implemented message from CloudFormation. It now returns the client name if one was configured by the user, `undefined` otherwise.
"attribute-tag:@aws-cdk/aws-cognito.UserPoolClient.userPoolClientName", | ||
"resource-attribute:@aws-cdk/aws-cognito.UserPoolClient.userPoolClientClientSecret" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Take a look at the note here - https://github.com/aws/aws-cdk/pull/7091/files#diff-112b6222454a4f23b78d56cd0fa66b95R88-R92 - on why these two are needed.
* The client name that was specified via the `userPoolClientName` property during initialization, | ||
* `undefined` otherwise. | ||
*/ | ||
public readonly userPoolClientName?: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would expect this to be an attribute and never undefined
, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, does not work. CloudFormation returns the message "Name attribute not supported at this time, please use the CLI or Console to retrieve this value"
See my comment here - https://github.com/aws/aws-cdk/pull/7091/files#diff-112b6222454a4f23b78d56cd0fa66b95R88-R92
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then I would implement this as a getter that throws an error if the name is not provided but at least we get a clean api that we can evolve later to return a token.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point
super(scope, id, { | ||
physicalName: props.userPoolClientName, | ||
}); | ||
super(scope, id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we not using physical name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
User pool clients generate their own primary identifiers (e.g. 6tapehhff4ov922cjnheqpfr23
) that cannot be specified as input. AFAIU, physical names are set for resources whose primary identifiers can be configured by the user. Am I wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay makes sense. Maybe add a comment.
generateSecret: props.generateSecret, | ||
userPoolId: props.userPool.userPoolId, | ||
explicitAuthFlows: props.enabledAuthFlows | ||
}); | ||
|
||
this.userPoolClientId = resource.ref; | ||
this.userPoolClientClientSecret = resource.attrClientSecret; | ||
this.userPoolClientName = resource.attrName; | ||
this.userPoolClientName = props.userPoolClientName; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would expect to call super.getResourceName()
added "do-not-merge" |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from master 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 master 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 |
Commit Message
Include other clean up around awslint exclusions and CloudFormation
resource attributes.
BREAKING CHANGE:
UserPoolClient
construct no longer has the propertyuserPoolClientClientSecret
. The functionality to retrieve the clientsecret never existed in CloudFormation, so this property was not
working in the first place.
userPoolClientName
property on theUserPoolClient
construct will throw an error if client name was not configured on the
UserPoolClient
during initialization. This property was previouslyincorrectly configured and was returning a not-implemented message from
CloudFormation every time.
End Commit Message
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license