briareus
Version:
Briareus assists with Feature Branch deploys to ECS
23 lines (17 loc) • 485 B
JavaScript
const auth = require('basic-auth');
const config = require('../config');
const errors = require('../errors');
// Super simple Authentication and Authorization
module.exports = function(service) {
return function (req, res, next) {
let credentials = auth(req);
if (!credentials) {
return next(new errors.NotAuthorized());
}
if (config.get('apiToken') !== credentials.pass) {
return next(new errors.Forbidden());
}
next();
};
};