-
Notifications
You must be signed in to change notification settings - Fork 554
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for Cognito pre token generation with access token cust…
…omization (#538) * Fixed Cognito service name and added event structure for Cognito pre token generation event V2 * gofmt -s -w . * Add sample data and serde test * Tweak the test data to avoid having to break response marshaling compatability of the GroupConfiguration struct --------- Co-authored-by: Bryan Moffatt <[email protected]> Co-authored-by: Bryan Moffatt <[email protected]>
- Loading branch information
1 parent
30d7c7e
commit 326401a
Showing
3 changed files
with
150 additions
and
15 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
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
71 changes: 71 additions & 0 deletions
71
events/testdata/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,71 @@ | ||
{ | ||
"version": "2", | ||
"triggerSource": "TokenGeneration_Authentication", | ||
"region": "us-west-2", | ||
"userPoolId": "us-east-1_EXAMPLE", | ||
"userName": "brcotter", | ||
"callerContext": { | ||
"awsSdkVersion": "aws-sdk-unknown-unknown", | ||
"clientId": "1example23456789" | ||
}, | ||
"request": { | ||
"userAttributes": { | ||
"sub": "a36036a8-9061-424d-a737-56d57dae7bc6", | ||
"cognito:email_alias": "[email protected]", | ||
"cognito:user_status": "CONFIRMED", | ||
"email_verified": "true", | ||
"email": "[email protected]" | ||
}, | ||
"groupConfiguration": { | ||
"groupsToOverride": [], | ||
"iamRolesToOverride": [], | ||
"preferredRole": null | ||
}, | ||
"scopes": [ | ||
"aws.cognito.signin.user.admin" | ||
] | ||
}, | ||
"response": { | ||
"claimsAndScopeOverrideDetails": { | ||
"idTokenGeneration": { | ||
"claimsToAddOrOverride": { | ||
"family_name": "xyz" | ||
}, | ||
"claimsToSuppress": [ | ||
"email", | ||
"birthdate" | ||
] | ||
}, | ||
"accessTokenGeneration": { | ||
"claimsToAddOrOverride": { | ||
"family_name": "xyz" | ||
}, | ||
"claimsToSuppress": [ | ||
"email", | ||
"birthdate" | ||
], | ||
"scopesToAdd": [ | ||
"scope1", | ||
"scope2", | ||
"scopeLomond" | ||
], | ||
"scopesToSuppress": [ | ||
"phone_number" | ||
] | ||
}, | ||
"groupOverrideDetails": { | ||
"groupsToOverride": [ | ||
"group-A", | ||
"group-B", | ||
"group-C" | ||
], | ||
"iamRolesToOverride": [ | ||
"arn:aws:iam::123456789012:role/sns_callerA", | ||
"arn:aws:iam::123456789012:role/sns_callerB", | ||
"arn:aws:iam::123456789012:role/sns_callerC" | ||
], | ||
"preferredRole": "arn:aws:iam::123456789012:role/sns_caller" | ||
} | ||
} | ||
} | ||
} |