-
Notifications
You must be signed in to change notification settings - Fork 348
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Event Definition for CognitoEventUserPoolsPreTokenGenV2 (#764)
The added structs allow for the processing of Version 2 Cognito PreToken generation in a Lambda The V2 payloads allow for customization of the Access Token in addition to the ID Token which was already supported
- Loading branch information
Showing
3 changed files
with
170 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
lambda-events/src/fixtures/example-cognito-event-userpools-pretokengen-v2-incoming.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"version": "1", | ||
"triggerSource": "PreTokenGen", | ||
"region": "region", | ||
"userPoolId": "userPoolId", | ||
"userName": "userName", | ||
"callerContext": { | ||
"awsSdkVersion": "calling aws sdk with version", | ||
"clientId": "apps client id" | ||
}, | ||
"request": { | ||
"userAttributes": { | ||
"email": "email", | ||
"phone_number": "phone_number" | ||
}, | ||
"scopes": ["scope-1", "scope-2"], | ||
"groupConfiguration": { | ||
"groupsToOverride": ["group-A", "group-B", "group-C"], | ||
"iamRolesToOverride": [ | ||
"arn:aws:iam::XXXXXXXXXXXX:role/sns_callerA", | ||
"arn:aws:iam::XXXXXXXXX:role/sns_callerB", | ||
"arn:aws:iam::XXXXXXXXXX:role/sns_callerC" | ||
], | ||
"preferredRole": "arn:aws:iam::XXXXXXXXXXX:role/sns_caller" | ||
}, | ||
"clientMetadata": { | ||
"exampleMetadataKey": "example metadata value" | ||
} | ||
}, | ||
"response": { | ||
"claimsOverrideDetails": null | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
lambda-events/src/fixtures/example-cognito-event-userpools-pretokengen-v2.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
"version": "1", | ||
"triggerSource": "PreTokenGen", | ||
"region": "region", | ||
"userPoolId": "userPoolId", | ||
"userName": "userName", | ||
"callerContext": { | ||
"awsSdkVersion": "calling aws sdk with version", | ||
"clientId": "apps client id" | ||
}, | ||
"request": { | ||
"userAttributes": { | ||
"email": "email", | ||
"phone_number": "phone_number" | ||
}, | ||
"scopes": ["scope-1", "scope-2"], | ||
"groupConfiguration": { | ||
"groupsToOverride": ["group-A", "group-B", "group-C"], | ||
"iamRolesToOverride": [ | ||
"arn:aws:iam::XXXXXXXXXXXX:role/sns_callerA", | ||
"arn:aws:iam::XXXXXXXXX:role/sns_callerB", | ||
"arn:aws:iam::XXXXXXXXXX:role/sns_callerC" | ||
], | ||
"preferredRole": "arn:aws:iam::XXXXXXXXXXX:role/sns_caller" | ||
}, | ||
"clientMetadata": { | ||
"exampleMetadataKey": "example metadata value" | ||
} | ||
}, | ||
"response": { | ||
"claimsAndScopeOverrideDetails": { | ||
"idTokenGeneration": { | ||
"claimsToAddOrOverride": { | ||
"string": "string" | ||
}, | ||
"claimsToSuppress": ["string", "string"] | ||
}, | ||
"accessTokenGeneration": { | ||
"claimsToAddOrOverride": { | ||
"attribute_key2": "attribute_value2", | ||
"attribute_key": "attribute_value" | ||
}, | ||
"claimsToSuppress": ["email", "phone"], | ||
"scopesToAdd": ["scope-B", "scope-B"], | ||
"scopesToSuppress": ["scope-C", "scope-D"] | ||
}, | ||
"groupOverrideDetails": { | ||
"groupsToOverride": ["group-A", "group-B", "group-C"], | ||
"iamRolesToOverride": [ | ||
"arn:aws:iam::XXXXXXXXXXXX:role/sns_callerA", | ||
"arn:aws:iam::XXXXXXXXX:role/sns_callerB", | ||
"arn:aws:iam::XXXXXXXXXX:role/sns_callerC" | ||
], | ||
"preferredRole": "arn:aws:iam::XXXXXXXXXXX:role/sns_caller" | ||
} | ||
} | ||
} | ||
} |