Repository navigation
Conversation
… JWT authorizer Protect REST API endpoints with a JWT authorizer under provider.apiGateway.authorizers that trusts an Amazon Cognito user pool in the same service, require an OAuth scope on one endpoint, and return the caller's claims from requestContext.authorizer.claims, decoding the validated token where API Gateway doesn't pass claims yet.
Contributor
Author
|
The live test installs the latest release, 4.46.0, which predates JWT authorizers for REST API Generated by Claude Code |
…jwt-authorizer # Conflicts: # README.md # examples.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
aws-node-rest-api-jwt-authorizer: a REST API whose endpoints are protected by a JWT authorizer defined underprovider.apiGateway.authorizers, with a Cognito user pool in the same service as the issuer (issuerUrl: !GetAtt UserPool.ProviderURL,audience: !Ref UserPoolClient,algorithms: [rs256]).GET /hellois public;GET /metakes an ID token;GET /accountrequires the scopeaws.cognito.signin.user.admin(access token).event.requestContext.authorizer.claims; where API Gateway doesn't pass claims to the integration, they decode the already-validated token from theAuthorizationheader.token_usereason).test/smoke.mjsruns the same steps for the live test.README.mdandexamples.jsonare regenerated.Merge after the Framework release that includes JWT authorizers for REST APIs (serverless/serverless#14153). The live test installs the latest release, so re-run it once that release is out.
Test plan
npm run docs,check-examples(0 errors),npm test(308 pass) andnpm run validatepass.test-example.mjsand the Framework from source (feat(aws-api-gateway): add JWT authorizers for REST API http events serverless#14153), in a test account:requestContext.authorizer.claims;checkstep.Generated by Claude Code