5 changed files with 28 additions and 5 deletions
@ -0,0 +1,11 @@ |
|||
var basicAuth = require('basic-auth'); |
|||
|
|||
module.exports = pass => (req, res, next) => { |
|||
var cred = basicAuth(req); |
|||
|
|||
if (cred && cred.pass === pass) |
|||
return next(); |
|||
|
|||
res.set('WWW-Authenticate', `Basic realm="Private Area"`) |
|||
.sendStatus(401); |
|||
} |
Loading…
Reference in new issue