Skip to content

Api Gateway authorizer improvements #827

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

Merged
merged 5 commits into from
Feb 21, 2024
Merged

Api Gateway authorizer improvements #827

merged 5 commits into from
Feb 21, 2024

Conversation

calavera
Copy link
Contributor

Issue #, if available:

The discussion in #823 made me think that we can provide much better ergonomics to work with Api Gateway Authorizers, since it looks like a common use case.

Description of changes:

There are changes in the events crate that are not backwards compatible, but I believe they provide much better user experience. I've divided this PR in three commits so you can check the changes out in isolation. There are more details in the commit messages.

By submitting this pull request

  • I confirm that my contribution is made under the terms of the Apache 2.0 license.
  • I confirm that I've made a best effort attempt to update all relevant documentation.

- Remove the generic attribute since the authorizer values are not always of the same type, just use Value.
- Match authorizer type to use the same type for all events.
- Make the authorizer fields match the Java and DotNet implementation, which both use a Map<String, Object> for Rest and WebSocket events.
-- https://github.com/aws/aws-lambda-dotnet/blob/master/Libraries/src/Amazon.Lambda.APIGatewayEvents/APIGatewayProxyRequest.cs
-- https://github.com/aws/aws-lambda-java-libs/blob/main/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2WebSocketEvent.java#L225

Signed-off-by: David Calavera <[email protected]>
This also shows how to work with the RequestExt trait and the RequestContext object.

Signed-off-by: David Calavera <[email protected]>
@calavera calavera requested a review from bnusunny February 21, 2024 05:20
Copy link
Contributor

@bnusunny bnusunny left a comment

Choose a reason for hiding this comment

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

LGTM

Make the name more consistent since it's used for multiple versions of Api Gateway.
Keep the old names as deprecated.

Signed-off-by: David Calavera <[email protected]>
@calavera calavera merged commit fabffbc into main Feb 21, 2024
@calavera calavera deleted the apigw_authorizer branch February 21, 2024 16:55
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