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): add defaultRedirectUri to UserPoolClient #30481

Merged
merged 8 commits into from
Jun 21, 2024

Conversation

mazyu36
Copy link
Contributor

@mazyu36 mazyu36 commented Jun 7, 2024

Issue # (if applicable)

N/A

Reason for this change

The defaulrRedirectUri property missing in the current UserPoolClient class,

The DefaultRedirectURI setting is essential when using Amazon Cognito Hosted UI because it specifies the primary destination where users will be redirected after successful authentication, ensuring a seamless and secure OAuth 2.0 or OpenID Connect flow.

Description of changes

Add missing property.

Description of how you validated changes

Add unit tests and integ tests.

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@aws-cdk-automation aws-cdk-automation requested a review from a team June 7, 2024 13:19
@github-actions github-actions bot added p2 admired-contributor [Pilot] contributed between 13-24 PRs to the CDK labels Jun 7, 2024
@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Jun 7, 2024
Copy link
Contributor

@lpizzinidev lpizzinidev left a comment

Choose a reason for hiding this comment

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

Thanks 👍 Some minor TODOs

packages/aws-cdk-lib/aws-cognito/lib/user-pool-client.ts Outdated Show resolved Hide resolved
packages/aws-cdk-lib/aws-cognito/README.md Outdated Show resolved Hide resolved
packages/aws-cdk-lib/aws-cognito/lib/user-pool-client.ts Outdated Show resolved Hide resolved
mazyu36 and others added 4 commits June 9, 2024 01:54
Co-authored-by: Luca Pizzini <lpizzini7@gmail.com>
Co-authored-by: Luca Pizzini <lpizzini7@gmail.com>
Co-authored-by: Luca Pizzini <lpizzini7@gmail.com>
@aws-cdk-automation aws-cdk-automation removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Jun 8, 2024
@mazyu36
Copy link
Contributor Author

mazyu36 commented Jun 8, 2024

@lpizzinidev
Thank you. I have incorporated your suggestions and made modifications.
The error message has been modified to display only the regular expression pattern.

Copy link
Contributor

@lpizzinidev lpizzinidev left a comment

Choose a reason for hiding this comment

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

Thanks 👍

@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Jun 9, 2024
@paulhcsun paulhcsun changed the title feat(cognito): add defaultRediretUri to UserPoolClient feat(cognito): add defaultRedirectUri to UserPoolClient Jun 19, 2024
Copy link
Contributor

@paulhcsun paulhcsun left a comment

Choose a reason for hiding this comment

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

Hi @mazyu36, thanks for the contribution! The code changes look good to me for the most part, I've just left a couple of clarifying questions.

throw new Error('defaultRedirectUri must be included in callbackUrls.');
}

const defaultRedirectUriPattern = /^(?=.{1,1024}$)[\p{L}\p{M}\p{S}\p{N}\p{P}]+$/u;
Copy link
Contributor

Choose a reason for hiding this comment

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

Where is this pattern obtained from and what is it matching against?

Copy link
Contributor Author

@mazyu36 mazyu36 Jun 20, 2024

Choose a reason for hiding this comment

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

Obtained from CFn document.

Pattern: [\p{L}\p{M}\p{S}\p{N}\p{P}]+

Minimum: 1

Maximum: 1024

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpoolclient.html#cfn-cognito-userpoolclient-defaultredirecturi

In my understanding, Most strings will match the pattern, but strings containing only whitespace characters or only special characters/symbols will not match.

Copy link
Contributor

@paulhcsun paulhcsun Jun 20, 2024

Choose a reason for hiding this comment

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

Thanks for clarifying! Should we also add some validation on the length here?

Edit: Nevermind, I see that this already checks the length.

Copy link
Contributor

@paulhcsun paulhcsun left a comment

Choose a reason for hiding this comment

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

Hi @mazyu36, thanks for the contribution! The code changes look good to me for the most part, I've just left a couple of clarifying questions.

@mazyu36
Copy link
Contributor Author

mazyu36 commented Jun 20, 2024

@paulhcsun
Thank you for the review!
I've replied to all your comments.

@mazyu36 mazyu36 requested a review from paulhcsun June 20, 2024 00:49
Copy link
Contributor

@paulhcsun paulhcsun left a comment

Choose a reason for hiding this comment

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

Looks good, nice work @mazyu36!

And thanks for the review @lpizzinidev!

@paulhcsun
Copy link
Contributor

@Mergifyio update

@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Jun 20, 2024
Copy link
Contributor

mergify bot commented Jun 20, 2024

update

✅ Branch has been successfully updated

Copy link
Contributor

mergify bot commented Jun 20, 2024

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

@mazyu36
Copy link
Contributor Author

mazyu36 commented Jun 21, 2024

@Mergifyio update

Copy link
Contributor

mergify bot commented Jun 21, 2024

update

✅ Branch has been successfully updated

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 29398d0
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

Copy link
Contributor

mergify bot commented Jun 21, 2024

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

@mergify mergify bot merged commit f2c5f68 into aws:main Jun 21, 2024
10 checks passed
@mazyu36 mazyu36 deleted the userpool-client-default-redirect-uri branch June 21, 2024 03:22
sarangarav pushed a commit to sarangarav/aws-cdk that referenced this pull request Jun 21, 2024
### Issue # (if applicable)

N/A

### Reason for this change
The `defaulrRedirectUri` property missing in the current `UserPoolClient` class,

The DefaultRedirectURI setting is essential when using Amazon Cognito Hosted UI because it specifies the primary destination where users will be redirected after successful authentication, ensuring a seamless and secure OAuth 2.0 or OpenID Connect flow.


### Description of changes
Add missing property.


### Description of how you validated changes
Add unit tests and integ tests.


### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
mazyu36 added a commit to mazyu36/aws-cdk that referenced this pull request Jun 22, 2024
### Issue # (if applicable)

N/A

### Reason for this change
The `defaulrRedirectUri` property missing in the current `UserPoolClient` class,

The DefaultRedirectURI setting is essential when using Amazon Cognito Hosted UI because it specifies the primary destination where users will be redirected after successful authentication, ensuring a seamless and secure OAuth 2.0 or OpenID Connect flow.


### Description of changes
Add missing property.


### Description of how you validated changes
Add unit tests and integ tests.


### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@aws-cdk-automation
Copy link
Collaborator

Comments on closed issues and PRs are hard for our team to see. If you need help, please open a new issue that references this one.

@aws aws locked as resolved and limited conversation to collaborators Jul 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
admired-contributor [Pilot] contributed between 13-24 PRs to the CDK p2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants