mirror of
https://github.com/janoside/btc-rpc-explorer.git
synced 2026-08-16 13:00:49 +02:00
15 lines
298 B
JavaScript
15 lines
298 B
JavaScript
"use strict";
|
|
|
|
const basicAuth = require('basic-auth');
|
|
|
|
module.exports = pass => (req, res, next) => {
|
|
var cred = basicAuth(req);
|
|
|
|
if (cred && cred.pass === pass) {
|
|
req.authenticated = true;
|
|
return next();
|
|
}
|
|
|
|
res.set('WWW-Authenticate', `Basic realm="Private Area"`)
|
|
.sendStatus(401);
|
|
}
|