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): user pool - required & custom attributes #6487

Merged
merged 8 commits into from
Mar 17, 2020

Conversation

nija-at
Copy link
Contributor

@nija-at nija-at commented Feb 27, 2020

Commit Message

feat(cognito): user pool - custom & mandatory standard attributes (#6487)

BREAKING CHANGE: UserPoolAttribute has been removed. It is no longer
required to defined a UserPool.

closes #1747

End Commit Message


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

BREAKING CHANGE: `UserPoolAttribute` has been renamed to
`StandardAttrs`.
@nija-at nija-at added the contribution/core This is a PR that came from AWS. label Feb 27, 2020
@nija-at nija-at requested a review from a team February 27, 2020 18:46
@nija-at nija-at self-assigned this Feb 27, 2020
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@eladb eladb changed the title feat(cognito): support custom attributes & mandatory standard attributes feat(cognito): custom & mandatory standard attributes Mar 1, 2020
packages/@aws-cdk/aws-cognito/lib/user-pool-attr.ts Outdated Show resolved Hide resolved
*
* @default - No attributes are required.
*/
readonly requiredAttributes?: StandardAttribute[];
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not a boolean map?

requiredAttributes: {
  email: true,
  phone: true
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't see much difference between having a boolean map vs. a list of enum here. Both provide pretty much a very similar experience.

The boolean map is quite handy when it comes to settings, such as "enable xxx" and there are some that default to true and some to false.
OTOH over here, we're asking the user to specify a set of fields that they want to make mandatory, and an array makes good sense.
Both have the same level of IDE autocomplete support.

Implementation wise - mapping each entry from a boolean map to the correct attribute name is another moving part that introduces human error.
I understand this needs to be designed from the customer experience and not from implementation complexity, but when the two experiences are close, it's worth considering this.

I'd prefer to leave this as a list of StandardAttribute. How strongly do you feel about having a boolean map here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Both have the same level of IDE autocomplete support.

I disagree that the ergonomics are equivalent. The IDE won’t expand the enum automatically and also will allow the user to specify each value multiple times which doesn’t make sense.

An array is not the “correct” data type here in my opinion, but I don’t think it’s critical!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fair enough. I've modified this per your suggestion.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@nija-at nija-at changed the title feat(cognito): custom & mandatory standard attributes feat(cognito): user pool - custom & mandatory standard attributes Mar 17, 2020
@nija-at nija-at requested a review from eladb March 17, 2020 09:27
Copy link
Contributor

@eladb eladb left a comment

Choose a reason for hiding this comment

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

I am okay with leaving this with an array if you feel strongly about it.

@nija-at nija-at changed the title feat(cognito): user pool - custom & mandatory standard attributes feat(cognito): user pool - required & custom attributes Mar 17, 2020
@nija-at nija-at requested a review from eladb March 17, 2020 12:17
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@nija-at nija-at added pr/do-not-merge This PR should not be merged at this time. and removed pr/do-not-merge This PR should not be merged at this time. labels Mar 17, 2020
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 30708fa
  • 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 17, 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).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 2fb3d43
  • 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 17, 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 6dfb677 into master Mar 17, 2020
@mergify mergify bot deleted the nija-at/cognito-userpool-attrs branch March 17, 2020 15:54
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.

Add support for Cognito Schema
3 participants