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

[examples] Add an example of an APIGateway Lambda Authorizer #453

Merged
merged 5 commits into from
Jan 6, 2025

Conversation

sebsto
Copy link
Contributor

@sebsto sebsto commented Jan 4, 2025

Add an example of an APIGateway Lambda Authorizer

Motivation:

Lambda Authorizers allow developers to write custom logic to validate HTTP REST requests.
This example shows how to write a Lambda Authorizer in Swift and how to configure an API Gateway to use a Lambda Authorizer.

This example use a SAM template to deploy the resources.

Modifications:

  • Add Examples/APIGateway+LambdaAuthorizer directory with the source code, a template.yaml, and a README file.
  • Add a reference to the new example in Examples/README
  • Modify CI to build the new example

Result:

There is a new example showing how to develop a Lambda authorizer in Swift and how to attach it to an APIGateway with SAM

@sebsto sebsto added the semver/none No version bump required. label Jan 4, 2025
@sebsto sebsto self-assigned this Jan 4, 2025
@sebsto sebsto requested review from 0xTim and adam-fowler January 4, 2025 14:47
@sebsto sebsto changed the title Add an example of an APIGateway Lambda Authorizer [examples] Add an example of an APIGateway Lambda Authorizer Jan 5, 2025
Copy link
Member

@0xTim 0xTim left a comment

Choose a reason for hiding this comment

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

One change to make

Unrelated - do we have CI set up for the examples?

When invoking the Lambda function without `Authorization` header, the response is a `401 Unauthorized` error.

```bash
curl -v https://6sm6270j21.execute-api.us-east-1.amazonaws.com/demo
Copy link
Member

Choose a reason for hiding this comment

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

This URL should probably match the URL from the output above

< content-length: 26
< apigw-requestid: D3bfpidOoAMESiQ=
<
* Connection #0 to host 6sm6270j21.execute-api.us-east-1.amazonaws.com left intact
Copy link
Member

Choose a reason for hiding this comment

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

As above, one needs to change

@sebsto
Copy link
Contributor Author

sebsto commented Jan 6, 2025

Thanks @0xTim for the review. I'll make the change and merge.

Yes, we have a CI flow for the examples :

@sebsto sebsto merged commit 051029f into main Jan 6, 2025
28 checks passed
@sebsto sebsto deleted the sebsto/authorizer branch January 6, 2025 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/none No version bump required.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants