API Gateway Custom Authorizer Policy Generator
A Policy Generator for API Gateway Custom Authorizers
Installation
npm i api-gateway-policy-gen
Usage
const utils = utils;const policyGenerator = policyGenerator; moduleexports { // Get's the token from the header in the format 'Bearer xxjklsadf' const idToken = utils; if !idToken return ; // Do something to ensure the user is authorized // i.e. decode JWT const user = ; const principalId = userid; const authInfo = utils; // optional context const context = role: 'admin' ; // allow access to all methods const result = policyGenerator; ;)
Contributions
Welcome. Please submit an issue before sending a PR.
License
MIT