Deprecate Cognito PreTokenGenV2 and introduce PreTokenGenV2_0 #589
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue #, if available:
#584
#585
Description of changes:
This inner
AccessTokenGeneration
andIDTokenGeneration
structs used in the PreTokenGenV2 event struct incorrectly restricts theClaimsToAddOrOverride
map values as strings, but Cognito supports any type when the trigger is configured for V2 or V3.This was fixed last year in the aws-lambda-dotnet project in aws/aws-lambda-dotnet#1799 - and released as a new major version of their Cognito events package aws/aws-lambda-dotnet#1798 (comment)
Correcting the structs in-place would:
So I copied all existing structs related to Cognito's PreTokenGen V2_0 request/response, and suffixed the copies with
V2_0
- took this convention from the current version of the documentation, which includes paragraphs like:So seemed appropriate to take that convention rather than coming up with an alternative way to 'V2' the existing 'V2' struct.
In the future,
V1_0
suffixed structs can also be introduced, to improve naming consistency in auto-complete and documentation.While the PreTokenGenV2 still works, I also added a
// Deprecated:
annotation to alert end users via their editors/linters that they may be missing out on some features.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.