mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 07:16:01 +00:00
azure auth moved to auth proxy
This commit is contained in:
@@ -399,11 +399,11 @@ module.exports = {
|
||||
},
|
||||
|
||||
dbloginToken_meta: true,
|
||||
async dbloginToken({ code, conid, strmid, redirectUri }) {
|
||||
async dbloginToken({ code, conid, strmid, redirectUri, sid }) {
|
||||
try {
|
||||
const connection = await this.getCore({ conid });
|
||||
const driver = requireEngineDriver(connection);
|
||||
const accessToken = await driver.getAuthTokenFromCode(connection, { code, redirectUri });
|
||||
const accessToken = await driver.getAuthTokenFromCode(connection, { sid, code, redirectUri });
|
||||
const volatile = await this.saveVolatile({ conid, accessToken });
|
||||
// console.log('******************************** WE HAVE ACCESS TOKEN', accessToken);
|
||||
socket.emit('got-volatile-token', { strmid, savedConId: conid, volatileConId: volatile._id });
|
||||
@@ -415,11 +415,11 @@ module.exports = {
|
||||
},
|
||||
|
||||
dbloginAuthToken_meta: true,
|
||||
async dbloginAuthToken({ amoid, code, conid, redirectUri }) {
|
||||
async dbloginAuthToken({ amoid, code, conid, redirectUri, sid }) {
|
||||
try {
|
||||
const connection = await this.getCore({ conid });
|
||||
const driver = requireEngineDriver(connection);
|
||||
const accessToken = await driver.getAuthTokenFromCode(connection, { code, redirectUri });
|
||||
const accessToken = await driver.getAuthTokenFromCode(connection, { code, redirectUri, sid });
|
||||
const volatile = await this.saveVolatile({ conid, accessToken });
|
||||
const authProvider = getAuthProviderById(amoid);
|
||||
const resp = await authProvider.login(null, null, { conid: volatile._id });
|
||||
|
||||
@@ -3,7 +3,7 @@ const fs = require('fs');
|
||||
const { pluginsdir, packagedPluginsDir, getPluginBackendPath } = require('../utility/directories');
|
||||
const nativeModules = require('../nativeModules');
|
||||
const platformInfo = require('../utility/platformInfo');
|
||||
const azureAuth = require('../utility/azureAuth');
|
||||
const authProxy = require('../utility/authProxy');
|
||||
const { getLogger } = require('dbgate-tools');
|
||||
const logger = getLogger('requirePlugin');
|
||||
|
||||
@@ -13,7 +13,7 @@ const dbgateEnv = {
|
||||
dbgateApi: null,
|
||||
nativeModules,
|
||||
platformInfo,
|
||||
azureAuth,
|
||||
authProxy,
|
||||
};
|
||||
function requirePlugin(packageName, requiredPlugin = null) {
|
||||
if (!packageName) throw new Error('Missing packageName in plugin');
|
||||
|
||||
17
packages/api/src/utility/authProxy.js
Normal file
17
packages/api/src/utility/authProxy.js
Normal file
@@ -0,0 +1,17 @@
|
||||
function isAuthProxySupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
async function authProxyGetRedirectUrl(options) {
|
||||
return null;
|
||||
}
|
||||
|
||||
async function authProxyGetTokenFromCode(options) {
|
||||
return null;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
isAuthProxySupported,
|
||||
authProxyGetRedirectUrl,
|
||||
authProxyGetTokenFromCode,
|
||||
};
|
||||
@@ -1,17 +0,0 @@
|
||||
function isAzureAuthSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
async function azureGetRedirectAuthUrl(options) {
|
||||
return null;
|
||||
}
|
||||
|
||||
async function azureGetAuthTokenFromCode(options) {
|
||||
return null;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
isAzureAuthSupported,
|
||||
azureGetRedirectAuthUrl,
|
||||
azureGetAuthTokenFromCode,
|
||||
};
|
||||
Reference in New Issue
Block a user