Skip to content

Commit 8a39f68

Browse files
committed
add a note about JWT token verification + fix typos
1 parent 898a42d commit 8a39f68

File tree

1 file changed

+8
-6
lines changed
  • Examples/APIGateway+LambdaAuthorizer

1 file changed

+8
-6
lines changed

Examples/APIGateway+LambdaAuthorizer/README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
# API Gateway
1+
# Lambda Authorizer with API Gateway
22

3-
This is an example of a Lambda Authorizer function. There are two Lambda function in this example. The first one is the authorizer function. The second one is the business function. The business function is exposed throigh a REST API using the API Gateway. The API Gateway is configured to use the authorizer function to authorize the requests.
3+
This is an example of a Lambda Authorizer function. There are two Lambda functions in this example. The first one is the authorizer function. The second one is the business function. The business function is exposed through a REST API using the API Gateway. The API Gateway is configured to use the authorizer function to implement a custom logic to authorize the requests.
4+
5+
>![NOTE]
6+
> If your application is protected by JWT tokens, it's recommended to use [the native JWT authorizer provided by the API Gateway](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-jwt-authorizer.html). The Lambda authorizer is useful when you need to implement a custom authorization logic. See the [OAuth 2.0/JWT authorizer example for AWS SAM](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-controlling-access-to-apis-oauth2-authorizer.html) to learn how to use the native JWT authorizer with SAM.
47
58
## Code
69

@@ -10,7 +13,6 @@ There are two possible responses from a Lambda Authorizer function: policy and s
1013

1114
This example uses an authorizer that returns the simple response. The authorizer function is defined in the `Sources/AuthorizerLambda` directory. The business function is defined in the `Sources/APIGatewayLambda` directory.
1215

13-
1416
## Build & Package
1517

1618
To build the package, type the following commands.
@@ -25,7 +27,7 @@ The ZIP file are located under `.build/plugins/AWSLambdaPackager/outputs/AWSLamb
2527

2628
## Deploy
2729

28-
The deployment must include the Lambda function and the API Gateway. We use the [Serverless Application Model (SAM)](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/what-is-sam.html) to deploy the infrastructure.
30+
The deployment must include the Lambda functions and the API Gateway. We use the [Serverless Application Model (SAM)](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/what-is-sam.html) to deploy the infrastructure.
2931

3032
**Prerequisites** : Install the [SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/install-sam-cli.html)
3133

@@ -49,7 +51,7 @@ The output is similar to this one.
4951
Outputs
5052
-----------------------------------------------------------------------------------------------------------------------------
5153
Key APIGatewayEndpoint
52-
Description API Gateway endpoint URLI
54+
Description API Gateway endpoint URI
5355
Value https://a5q74es3k2.execute-api.us-east-1.amazonaws.com/demo
5456
-----------------------------------------------------------------------------------------------------------------------------
5557
```
@@ -79,7 +81,7 @@ curl -v https://6sm6270j21.execute-api.us-east-1.amazonaws.com/demo
7981
{"message":"Unauthorized"}
8082
```
8183

82-
When invoking the Lambda function with the `Authorization` header, the response is a `200 OK` status code.
84+
When invoking the Lambda function with the `Authorization` header, the response is a `200 OK` status code. Note that the Lambda Authorizer function is configured to accept any value in the `Authorization` header.
8385

8486
```bash
8587
curl -v -H 'Authorization: 123' https://6sm6270j21.execute-api.us-east-1.amazonaws.com/demo

0 commit comments

Comments
 (0)