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

fix(auth): configure with standardAttributes snake case values #3686

Merged
merged 1 commit into from
May 8, 2024

Conversation

lawmicha
Copy link
Contributor

@lawmicha lawmicha commented May 8, 2024

Issue #

Description

There is a customization to the decoder that takes snake case and converts it to camel case. This works for property keys, but not the values themselves. This was a miss in translating the cognito standard attributes over to the enum without the exact value, in snake case.

Schema of the enum values: https://github.com/aws-amplify/amplify-backend/blob/main/packages/client-config/src/client-config-schema/schema_v1.json#L347-L370

"amazon_cognito_standard_attributes": {
      "description": "Amazon Cognito standard attributes for users -- https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-attributes.html",
      "type": "string",
      "enum": [
        "address",
        "birthdate",
        "email",
        "family_name",
        "gender",
        "given_name",
        "locale",
        "middle_name",
        "name",
        "nickname",
        "phone_number",
        "picture",
        "preferred_username",
        "profile",
        "sub",
        "updated_at",
        "website",
        "zoneinfo"
      ]
    },

General Checklist

  • Added new tests to cover change, if needed
  • Build succeeds with all target using Swift Package Manager
  • All unit tests pass
  • All integration tests pass
  • Security oriented best practices and standards are followed (e.g. using input sanitization, principle of least privilege, etc)
  • Documentation update for the change if required
  • PR title conforms to conventional commit style
  • New or updated tests include Given When Then inline code documentation and are named accordingly testThing_condition_expectation()
  • If breaking change, documentation/changelog update with migration instructions

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

@lawmicha lawmicha requested a review from a team as a code owner May 8, 2024 18:31
Copy link
Member

@harsh62 harsh62 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

codecov bot commented May 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.53%. Comparing base (668095a) to head (188c428).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3686      +/-   ##
==========================================
+ Coverage   67.46%   68.53%   +1.07%     
==========================================
  Files         984     1096     +112     
  Lines       33409    38089    +4680     
==========================================
+ Hits        22539    26106    +3567     
- Misses      10870    11983    +1113     
Flag Coverage Δ
API_plugin_unit_test 68.96% <ø> (ø)
AWSPluginsCore 65.67% <ø> (ø)
Amplify 48.25% <ø> (+0.04%) ⬆️
Analytics_plugin_unit_test 84.52% <ø> (?)
Auth_plugin_unit_test 79.37% <ø> (+0.08%) ⬆️
CoreMLPredictions_plugin_unit_test 61.15% <ø> (ø)
DataStore_plugin_unit_test 82.45% <ø> (+1.04%) ⬆️
Geo_plugin_unit_test 73.50% <ø> (ø)
Logging_plugin_unit_test 62.87% <ø> (?)
Predictions_plugin_unit_test 37.31% <ø> (ø)
PushNotifications_plugin_unit_test 86.21% <ø> (ø)
Storage_plugin_unit_test 76.75% <ø> (?)
unit_tests 68.53% <ø> (+1.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@harsh62 harsh62 merged commit b864d41 into main May 8, 2024
84 checks passed
@harsh62 harsh62 deleted the fix.auth-decode-standard-attributes branch May 8, 2024 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants