express: Move preAuthorize middleware before express-session

This commit is contained in:
Richard Hansen 2021-12-18 16:54:23 -05:00
parent bf35dcfc50
commit 0b1ec20c5c

View file

@ -201,11 +201,11 @@ exports.restartServer = async () => {
secure: 'auto',
},
});
app.use(exports.sessionMiddleware);
app.use(cookieParser(settings.sessionKey, {}));
// If webaccess.preAuthorize explicitly grants access, webaccess.checkAccess will skip all checks.
app.use(webaccess.preAuthorize);
app.use(exports.sessionMiddleware);
app.use(cookieParser(settings.sessionKey, {}));
app.use(webaccess.checkAccess);
await Promise.all([