mirror of
https://github.com/glenndehaan/unifi-voucher-site.git
synced 2026-04-05 08:54:17 -04:00
Implemented the 'AUTH_INTERNAL_ENABLED' and 'AUTH_OIDC_ENABLED' environment variables. Removed complex if structures with 'AUTH_OIDC_ENABLED' checks. Updated README.md
This commit is contained in:
@@ -25,7 +25,7 @@ module.exports = {
|
||||
*/
|
||||
web: async (req, res, next) => {
|
||||
// Check if authentication is enabled & OIDC is disabled
|
||||
if(!variables.authDisabled && (variables.authOidcIssuerBaseUrl === '' && variables.authOidcAppBaseUrl === '' && variables.authOidcClientId === '')) {
|
||||
if(!variables.authDisabled && !variables.authOidcEnabled) {
|
||||
// Check if user has an existing authorization cookie
|
||||
if (!req.cookies.authorization) {
|
||||
res.redirect(302, `${req.headers['x-ingress-path'] ? req.headers['x-ingress-path'] : ''}/login`);
|
||||
@@ -46,7 +46,7 @@ module.exports = {
|
||||
}
|
||||
|
||||
// Check if authentication is enabled & OIDC is enabled
|
||||
if(!variables.authDisabled && (variables.authOidcIssuerBaseUrl !== '' && variables.authOidcAppBaseUrl !== '' && variables.authOidcClientId !== '')) {
|
||||
if(!variables.authDisabled && variables.authOidcEnabled) {
|
||||
const middleware = oidc.requiresAuth();
|
||||
return middleware(req, res, next);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user