0.1.3 • Published 5 years ago
pambda-jwt-authorizer v0.1.3
pambda-jwt-authorizer
Pambda to authorize with JWT.
Installation
npm i pambda-jwt-authorizerUsage
const { compose, createLambda } = require('pambda');
const { jwtAurhotizer } = require('pambda-jwt-authorizer');
const LOCAL = process.env.AWS_SAM_LOCAL === 'true';
exports.handler = createLambda(
compose(
!LOCAL && cognitoAuthorizer({
/*
* Redirect to the signin site.
*/
unauthorized(event, context, callback) {
// ...
},
}),
// Provide pambdas for authorized users.
)
);API
jwtAuthorizer(options)
options.jwksUrioptions.unauthorized
cognitoAuthorizer(options)
options.regionoptions.userPoolIdoptions.unauthorized
License
MIT