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

Corrected the data type for ClaimsToAddOrOverride property in IdTokenGeneration and AccessTokenGeneration classes for CognitoPreTokenGenerationV2Event. #1799

Merged

Conversation

ashishdhingra
Copy link
Contributor

@ashishdhingra ashishdhingra commented Aug 28, 2024

Issue #, if available: #1798 (additional context #1792)

Description of changes:
Corrected the data type for ClaimsToAddOrOverride property in IdTokenGeneration and AccessTokenGeneration classes for CognitoPreTokenGenerationV2Event.

Per Pre token generation Lambda trigger, following is the event structure for V2 event:

{
    "request": {
        "userAttributes": {
            "string": "string"
        },
        "scopes": ["string", "string"],
        "groupConfiguration": {
            "groupsToOverride": ["string", "string"],
            "iamRolesToOverride": ["string", "string"],
            "preferredRole": "string"
        },
        "clientMetadata": {
            "string": "string"
        }
    },
    "response": {
        "claimsAndScopeOverrideDetails": {
            "idTokenGeneration": {
                "claimsToAddOrOverride": {
                    "string": [accepted datatype]
                },
                "claimsToSuppress": ["string", "string"]
            },
            "accessTokenGeneration": {
                "claimsToAddOrOverride": {
                    "string": [accepted datatype]
                },
                "claimsToSuppress": ["string", "string"],
                "scopesToAdd": ["string", "string"],
                "scopesToSuppress": ["string", "string"]
            },
            "groupOverrideDetails": {
                "groupsToOverride": ["string", "string"],
                "iamRolesToOverride": ["string", "string"],
                "preferredRole": "string"
            }
        }
    }
}

Notice that claimsToAddOrOverride for both idTokenGeneration and accessTokenGeneration has structure "string": [accepted datatype], where accepted datatype is one of the following:

  • String
  • Number
  • Boolean
  • Array of strings, numbers, booleans, or a combination of any of these
  • JSON

IMPORTANT: This is a breaking change and should be called out explicitly in CHANGELOG.


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

@@ -6,7 +6,7 @@
<Description>Amazon Lambda .NET Core support - CognitoEvents package.</Description>
<TargetFrameworks>netstandard2.0;netcoreapp3.1;net8.0</TargetFrameworks>
Copy link
Contributor

Choose a reason for hiding this comment

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

Unrelated to the actual change, but since we're doing a major version bump, should we just drop netcoreapp3.1?

Copy link
Contributor Author

@ashishdhingra ashishdhingra Aug 30, 2024

Choose a reason for hiding this comment

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

I think we should. We still have handful of packages having netcoreapp3.1 target framework though.

@normj Please advise.

@ashishdhingra ashishdhingra merged commit 5d4e18b into dev Sep 3, 2024
2 of 4 checks passed
@ashishdhingra ashishdhingra deleted the user/ashdhin/CognitoPreTokenGenerationV2Event-Issue1798-Fix branch September 3, 2024 16:56
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.

3 participants