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): import an existing user pool client #7091

Merged
merged 4 commits into from
Mar 31, 2020

Conversation

nija-at
Copy link
Contributor

@nija-at nija-at commented Mar 31, 2020

Commit Message

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 will throw an error if client name was not configured on the
    UserPoolClient during initialization. This property was previously
    incorrectly 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

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.
@nija-at nija-at requested a review from a team March 31, 2020 14:10
@nija-at nija-at self-assigned this Mar 31, 2020
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Mar 31, 2020
Comment on lines +93 to +94
"attribute-tag:@aws-cdk/aws-cognito.UserPoolClient.userPoolClientName",
"resource-attribute:@aws-cdk/aws-cognito.UserPoolClient.userPoolClientClientSecret"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

* The client name that was specified via the `userPoolClientName` property during initialization,
* `undefined` otherwise.
*/
public readonly userPoolClientName?: string;
Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point

Comment on lines -70 to +96
super(scope, id, {
physicalName: props.userPoolClientName,
});
super(scope, id);
Copy link
Contributor

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?

Copy link
Contributor Author

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?

Copy link
Contributor

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;
Copy link
Contributor

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()

@eladb eladb added the pr/do-not-merge This PR should not be merged at this time. label Mar 31, 2020
@eladb
Copy link
Contributor

eladb commented Mar 31, 2020

added "do-not-merge"

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: d1cc849
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@nija-at nija-at requested a review from eladb March 31, 2020 15:19
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: ca393fe
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@nija-at nija-at removed the pr/do-not-merge This PR should not be merged at this time. label Mar 31, 2020
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: ae92939
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify
Copy link
Contributor

mergify bot commented Mar 31, 2020

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).

@mergify
Copy link
Contributor

mergify bot commented Mar 31, 2020

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).

@mergify mergify bot merged commit abc2144 into master Mar 31, 2020
@mergify mergify bot deleted the nija-at/cognito-userpoolclient-import branch March 31, 2020 17:15
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 6c30c4e
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants