mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-29 11:03:57 +00:00
admin page fix
This commit is contained in:
@@ -25,7 +25,9 @@ function authMiddleware(req, res, next) {
|
|||||||
|
|
||||||
// console.log('********************* getAuthProvider()', getAuthProvider());
|
// console.log('********************* getAuthProvider()', getAuthProvider());
|
||||||
|
|
||||||
if (!getAuthProvider().shouldAuthorizeApi()) {
|
const isAdminPage = req.headers['x-is-admin-page'] == 'true';
|
||||||
|
|
||||||
|
if (!isAdminPage && !getAuthProvider().shouldAuthorizeApi()) {
|
||||||
return next();
|
return next();
|
||||||
}
|
}
|
||||||
let skipAuth = !!SKIP_AUTH_PATHS.find(x => req.path == getExpressPath(x));
|
let skipAuth = !!SKIP_AUTH_PATHS.find(x => req.path == getExpressPath(x));
|
||||||
|
|||||||
@@ -21,5 +21,8 @@ export function resolveApiHeaders() {
|
|||||||
if (accessToken) {
|
if (accessToken) {
|
||||||
res['Authorization'] = `Bearer ${accessToken}`;
|
res['Authorization'] = `Bearer ${accessToken}`;
|
||||||
}
|
}
|
||||||
|
if (isAdminPage()) {
|
||||||
|
res['x-is-admin-page'] = 'true';
|
||||||
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user