You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
API Review Session for `aws-apigatewayv2-alpha`, `aws-apigatewayv2-authorizers-alpha`, and `aws-apigatewayv2-integrations-alpha`.
----
*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Copy file name to clipboardExpand all lines: packages/@aws-cdk/aws-apigatewayv2-alpha/README.md
+13-5
Original file line number
Diff line number
Diff line change
@@ -46,6 +46,8 @@ This module supports features under [API Gateway v2](https://docs.aws.amazon.com
46
46
that lets users set up Websocket and HTTP APIs.
47
47
REST APIs can be created using the `aws-cdk-lib/aws-apigateway` module.
48
48
49
+
HTTP and Websocket APIs use the same CloudFormation resources under the hood. However, this module separates them into two separate constructs for a more efficient abstraction since there are a number of CloudFormation properties that specifically apply only to each type of API.
50
+
49
51
## HTTP API
50
52
51
53
HTTP APIs enable creation of RESTful APIs that integrate with AWS Lambda functions, known as Lambda proxy integration,
@@ -65,16 +67,15 @@ integration, HTTP proxy integration and, AWS service integrations, also known as
Integrations are available at the `aws-apigatewayv2-integrations` module and more information is available in that module.
68
-
As an early example, the following code snippet configures a route `GET /books` with an HTTP proxy integration all
69
-
configures all other HTTP method calls to `/books` to a lambda proxy.
70
+
As an early example, we have a website for a bookstore where the following code snippet configures a route `GET /books` with an HTTP proxy integration. All other HTTP method calls to `/books` route to a default lambda proxy for the bookstore.
Access control for Http Apis is managed by restricting which routes can be invoked via.
42
+
Access control for HTTP APIs is managed by restricting which routes can be invoked via.
43
43
44
-
Authorizers and scopes can either be applied to the api, or specifically for each route.
44
+
Authorizers and scopes can either be applied to the API, or specifically for each route.
45
45
46
46
### Default Authorization
47
47
48
-
When using default authorization, all routes of the api will inherit the configuration.
48
+
When using default authorization, all routes of the API will inherit the configuration.
49
49
50
50
In the example below, all routes will require the `manage:books` scope present in order to invoke the integration.
51
51
@@ -65,12 +65,12 @@ const api = new apigwv2.HttpApi(this, 'HttpApi', {
65
65
66
66
### Route Authorization
67
67
68
-
Authorization can also configured for each Route. When a route authorization is configured, it takes precedence over default authorization.
68
+
Authorization can also be configured for each Route. When a route authorization is configured, it takes precedence over default authorization.
69
69
70
70
The example below showcases default authorization, along with route authorization. It also shows how to remove authorization entirely for a route.
71
71
72
72
-`GET /books` and `GET /books/{id}` use the default authorizer settings on the api
73
-
-`POST /books` will require the [write:books] scope
73
+
-`POST /books` will require the `['write:books']` scope
74
74
-`POST /login` removes the default authorizer (unauthenticated route)
75
75
76
76
```ts
@@ -120,7 +120,7 @@ JWT authorizers allow the use of JSON Web Tokens (JWTs) as part of [OpenID Conne
120
120
121
121
When configured, API Gateway validates the JWT submitted by the client, and allows or denies access based on its content.
122
122
123
-
The location of the token is defined by the `identitySource` which defaults to the http`Authorization` header. However it also
123
+
The location of the token is defined by the `identitySource` which defaults to the HTTP`Authorization` header. However it also
124
124
[supports a number of other options](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-lambda-authorizer.html#http-api-lambda-authorizer.identity-sources).
125
125
It then decodes the JWT and validates the signature and claims, against the options defined in the authorizer and route (scopes).
126
126
For more information check the [JWT Authorizer documentation](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-jwt-authorizer.html).
@@ -150,7 +150,7 @@ api.addRoutes({
150
150
151
151
#### User Pool Authorizer
152
152
153
-
User Pool Authorizer is a type of JWT Authorizer that uses a Cognito user pool and app client to control who can access your Api. After a successful authorization from the app client, the generated access token will be used as the JWT.
153
+
User Pool Authorizer is a type of JWT Authorizer that uses a Cognito user pool and app client to control who can access your API. After a successful authorization from the app client, the generated access token will be used as the JWT.
154
154
155
155
Clients accessing an API that uses a user pool authorizer must first sign in to a user pool and obtain an identity or access token.
156
156
They must then use this token in the specified `identitySource` for the API call. More information is available at [using Amazon Cognito user
0 commit comments