mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 07:16:01 +00:00
azure auth WIP
This commit is contained in:
@@ -16,6 +16,7 @@ const { safeJsonParse, getLogger } = require('dbgate-tools');
|
||||
const platformInfo = require('../utility/platformInfo');
|
||||
const { connectionHasPermission, testConnectionPermission } = require('../utility/hasPermission');
|
||||
const pipeForkLogs = require('../utility/pipeForkLogs');
|
||||
const requireEngineDriver = require('../utility/requireEngineDriver');
|
||||
|
||||
const logger = getLogger('connections');
|
||||
|
||||
@@ -345,7 +346,7 @@ module.exports = {
|
||||
|
||||
const storage = require('./storage');
|
||||
|
||||
const storageConnection = await storage.getConnection({conid});
|
||||
const storageConnection = await storage.getConnection({ conid });
|
||||
if (storageConnection) {
|
||||
return storageConnection;
|
||||
}
|
||||
@@ -379,4 +380,16 @@ module.exports = {
|
||||
});
|
||||
return res;
|
||||
},
|
||||
|
||||
dblogin_meta: {
|
||||
raw: true,
|
||||
method: 'get',
|
||||
},
|
||||
async dblogin(req, res) {
|
||||
const { conid } = req.query;
|
||||
const connection = await this.getCore({ conid });
|
||||
const driver = requireEngineDriver(connection);
|
||||
const authUrl = driver.getRedirectAuthUrl(connection);
|
||||
res.redirect(authUrl);
|
||||
},
|
||||
};
|
||||
|
||||
@@ -89,6 +89,9 @@ module.exports = {
|
||||
if (connection.passwordMode == 'askPassword' || connection.passwordMode == 'askUser') {
|
||||
throw new MissingCredentialsError({ conid, passwordMode: connection.passwordMode });
|
||||
}
|
||||
if (connection.useRedirectDbLogin) {
|
||||
throw new MissingCredentialsError({ conid, redirectToDbLogin: true });
|
||||
}
|
||||
const subprocess = fork(
|
||||
global['API_PACKAGE'] || process.argv[1],
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user