mirror of
https://github.com/glenndehaan/unifi-voucher-site.git
synced 2026-04-05 08:54:17 -04:00
Moved fetchUserInfo call to authorization.js middleware. Catch fetchUserInfo exceptions, causing invalided session to be stuck
This commit is contained in:
@@ -51,6 +51,15 @@ module.exports = {
|
||||
// Check if OIDC is enabled then verify user status
|
||||
if(variables.authOidcEnabled) {
|
||||
oidc = req.oidc.isAuthenticated();
|
||||
|
||||
// Retrieve user info/verify user session is still valid
|
||||
req.user = await req.oidc.fetchUserInfo().catch(() => {
|
||||
res.redirect(302, `${req.headers['x-ingress-path'] ? req.headers['x-ingress-path'] : ''}/login`);
|
||||
});
|
||||
|
||||
if(!req.user) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if user is authorized by a service
|
||||
|
||||
Reference in New Issue
Block a user