mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-21 00:06:01 +00:00
SYNC: SKIP_ALL_AUTH support
This commit is contained in:
committed by
Diflow
parent
23065f2c4b
commit
949817f597
@@ -67,6 +67,11 @@ function authMiddleware(req, res, next) {
|
|||||||
|
|
||||||
// const isAdminPage = req.headers['x-is-admin-page'] == 'true';
|
// const isAdminPage = req.headers['x-is-admin-page'] == 'true';
|
||||||
|
|
||||||
|
if (process.env.SKIP_ALL_AUTH) {
|
||||||
|
// API is not authorized for basic auth
|
||||||
|
return next();
|
||||||
|
}
|
||||||
|
|
||||||
if (process.env.BASIC_AUTH) {
|
if (process.env.BASIC_AUTH) {
|
||||||
// API is not authorized for basic auth
|
// API is not authorized for basic auth
|
||||||
return next();
|
return next();
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ module.exports = {
|
|||||||
),
|
),
|
||||||
isAdminPasswordMissing,
|
isAdminPasswordMissing,
|
||||||
isInvalidToken: req?.isInvalidToken,
|
isInvalidToken: req?.isInvalidToken,
|
||||||
|
skipAllAuth: !!process.env.SKIP_ALL_AUTH,
|
||||||
adminPasswordState: adminConfig?.adminPasswordState,
|
adminPasswordState: adminConfig?.adminPasswordState,
|
||||||
storageDatabase: process.env.STORAGE_DATABASE,
|
storageDatabase: process.env.STORAGE_DATABASE,
|
||||||
logsFilePath: getLogsFilePath(),
|
logsFilePath: getLogsFilePath(),
|
||||||
|
|||||||
@@ -307,6 +307,9 @@ export function getAuthCategory(config) {
|
|||||||
if (getElectron()) {
|
if (getElectron()) {
|
||||||
return 'electron';
|
return 'electron';
|
||||||
}
|
}
|
||||||
|
if (config.skipAllAuth) {
|
||||||
|
return 'none';
|
||||||
|
}
|
||||||
return 'token';
|
return 'token';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user