hapi-gitlab-webhooks
Github version here: node-github-webhook.
Description
An authentication strategy plugin for hapi for validating webhook requests from Gitlab. This strategy validates the payload with the signature sent with the request.
The 'gitlabwebhook'
scheme takes the following options:
secret
- (required) the token configured for the webhook (never share or commit this to your project!)
Usage
var hapi = require('hapi');
var gitlabWebhooksPlugin = require('hapi-gitlab-webhooks');
var token = 'SomeUnsharedSecretToken';
var server = new hapi.Server();
server.connection({
host: host,
port: port
});
server.register(gitlabWebhooksPlugin, function (err) {
server.auth.strategy('gitlabwebhook', 'gitlabwebhook', { secret: token});
server.route([
{
method: 'POST',
path: '/webhooks/gitlab',
config: {
auth: {
strategies: ['gitlabwebhook'],
payload: 'required'
}
},
handler: function(request, reply) {
reply();
}
}
]);
});