hapi-cognito-lambda
v1.0.2
Published
Cognito Authorization plugin for AWS Lambdas
Downloads
2
Maintainers
Readme
hapi-cognito
Lead Maintainer: Alessandro Oliveira
Cognito is an Amazon Web Services User Pool with full user management lifecycle.
Since AWS API Gateway has native integration with Cognito for Authentication purposes, I created this plugin just for basic authorization based on Cognito Groups.
In order to make it work properly you only need to:
- Register plugin
- Configure Group you want to check
var plugins = [
{
register: require('hapi-cognito')
}
];
server.register(plugins, function(err){
if (err) {
throw err;
}
server.route([
{
method : 'GET',
path : '/check',
handler : category_controller.listAll,
config: {
plugins: {
pagination: {
enabled: true
},
cognito: {
required: true,
group: 'Administrator'
}
}
}
}
]);
server.start(function() {
logger.info('Server running at:', server.info.uri);
});
});
There is a lot of improvement opportunities, feel free to send push requests.