mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-28 07:16:00 +00:00
multiauth refactor
This commit is contained in:
@@ -12,6 +12,7 @@ import uuidv1 from 'uuid/v1';
|
||||
import { openWebLink } from './exportFileTools';
|
||||
import { callServerPing } from './connectionsPinger';
|
||||
import { batchDispatchCacheTriggers, dispatchCacheChange } from './cache';
|
||||
import { isAdminPage } from './pageDefs';
|
||||
|
||||
export const strmid = uuidv1();
|
||||
|
||||
@@ -251,6 +252,19 @@ export function installNewVolatileConnectionListener() {
|
||||
});
|
||||
}
|
||||
|
||||
export function getAuthCategory(config) {
|
||||
if (config.isBasicAuth) {
|
||||
return 'basic';
|
||||
}
|
||||
if (isAdminPage() && config.isAdminLoginForm) {
|
||||
return 'admin';
|
||||
}
|
||||
if (getElectron()) {
|
||||
return 'electron';
|
||||
}
|
||||
return 'token';
|
||||
}
|
||||
|
||||
function enableApiLog() {
|
||||
apiLogging = true;
|
||||
console.log('API loggin enabled');
|
||||
|
||||
@@ -21,8 +21,8 @@ export function resolveApiHeaders() {
|
||||
if (accessToken) {
|
||||
res['Authorization'] = `Bearer ${accessToken}`;
|
||||
}
|
||||
if (isAdminPage()) {
|
||||
res['x-is-admin-page'] = 'true';
|
||||
}
|
||||
// if (isAdminPage()) {
|
||||
// res['x-is-admin-page'] = 'true';
|
||||
// }
|
||||
return res;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user