AuthorizerResource
Source:
src/AWS/ApiGatewayV2/Authorizer.ts
An API Gateway v2 Authorizer — controls access to HTTP/WebSocket API
routes via JWT validation or a Lambda (REQUEST) authorizer.
JWT authorizers
Section titled “JWT authorizers”The common HTTP API authorizer: API Gateway validates the caller’s JWT against the issuer’s JWKS and matches the audience — no Lambda invoked.
const authorizer = yield* ApiGatewayV2.Authorizer("Jwt", { api, authorizerType: "JWT", identitySource: ["$request.header.Authorization"], jwtConfiguration: { Issuer: `https://cognito-idp.us-west-2.amazonaws.com/${userPoolId}`, Audience: [clientId], },});
yield* ApiGatewayV2.Route("Secure", { api, routeKey: "GET /me", integration, authorizationType: "JWT", authorizerId: authorizer.authorizerId,});Lambda (REQUEST) authorizers
Section titled “Lambda (REQUEST) authorizers”const authorizer = yield* ApiGatewayV2.Authorizer("Lambda", { api, authorizerType: "REQUEST", identitySource: ["$request.header.Authorization"], authorizerUri: invocationUri, authorizerPayloadFormatVersion: "2.0", enableSimpleResponses: true,});