mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-05-01 19:42:29 +00:00
23 lines
482 B
JavaScript
23 lines
482 B
JavaScript
const Access = require('../access');
|
|
|
|
module.exports = () => {
|
|
return function (req, res, next) {
|
|
res.locals.access = null;
|
|
let access = new Access(res.locals.token || null);
|
|
|
|
// Allow unauthenticated access to get the oidc configuration
|
|
let oidc_access =
|
|
req.url === '/oidc-config' &&
|
|
req.method === 'GET' &&
|
|
!access.token.getUserId();
|
|
|
|
access.load(oidc_access)
|
|
.then(() => {
|
|
res.locals.access = access;
|
|
next();
|
|
})
|
|
.catch(next);
|
|
};
|
|
};
|
|
|