Forward Auth refactor and adding PROXY_FORWARD_AUTH_LOGOUT_URI env

This commit is contained in:
advplyr 2022-12-18 11:37:45 -06:00
parent 8558baf30a
commit 73a61872fa
9 changed files with 139 additions and 68 deletions

View file

@ -120,6 +120,13 @@ class MiscController {
Logger.error('Invalid user in authorize')
return res.sendStatus(401)
}
// When authorizing an API token and forward auth is enabled then validate user using forward auth headers
if (global.ForwardAuth.Enabled && !this.auth.validateForwardAuthUser(req)) {
Logger.error(`[MiscController] Authorize token with forward auth enabled failed for user "${req.user.username}"`)
return res.sendStatus(403)
}
const userResponse = this.auth.getUserLoginResponsePayload(req.user, this.rssFeedManager.feedsArray)
res.json(userResponse)
}