UNPKG

agenda-admin

Version:
22 lines (21 loc) 759 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.authentication = void 0; const express_basic_auth_1 = __importDefault(require("express-basic-auth")); const options_1 = require("../options"); const authentication = (req, res, next) => { const { username, password } = (0, options_1.getOptions)(); if (process.env.NODE_ENV === 'testing' || !password) { return next(); } (0, express_basic_auth_1.default)({ users: { [username]: password, }, challenge: true, })(req, res, next); }; exports.authentication = authentication;