Add whitelist mode (#11291)
This commit is contained in:
parent
85b7b565de
commit
24552b5160
44 changed files with 302 additions and 53 deletions
|
@ -12,6 +12,7 @@ const uuid = require('uuid');
|
|||
const fs = require('fs');
|
||||
|
||||
const env = process.env.NODE_ENV || 'development';
|
||||
const alwaysRequireAuth = process.env.WHITELIST_MODE === 'true' || process.env.AUTHORIZED_FETCH === 'true';
|
||||
|
||||
dotenv.config({
|
||||
path: env === 'production' ? '.env.production' : '.env',
|
||||
|
@ -271,7 +272,7 @@ const startWorker = (workerId) => {
|
|||
|
||||
const wsVerifyClient = (info, cb) => {
|
||||
const location = url.parse(info.req.url, true);
|
||||
const authRequired = !PUBLIC_STREAMS.some(stream => stream === location.query.stream);
|
||||
const authRequired = alwaysRequireAuth || !PUBLIC_STREAMS.some(stream => stream === location.query.stream);
|
||||
const allowedScopes = [];
|
||||
|
||||
if (authRequired) {
|
||||
|
@ -306,7 +307,7 @@ const startWorker = (workerId) => {
|
|||
return;
|
||||
}
|
||||
|
||||
const authRequired = !PUBLIC_ENDPOINTS.some(endpoint => endpoint === req.path);
|
||||
const authRequired = alwaysRequireAuth || !PUBLIC_ENDPOINTS.some(endpoint => endpoint === req.path);
|
||||
const allowedScopes = [];
|
||||
|
||||
if (authRequired) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue