mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-22 17:22:59 -05:00
Add default auth type configuration setting for Azure resources (#16999)
* Adding user config for default auth type * adding feature * removing the SqlLogin default from the model * fixing bug, removing dead code * removing unneeded instance of configurationService * fixing line break * removing extra parameter * removing comments * Fix test breaks * Fix build break * More breaks * Address code review feedback Co-authored-by: Troy Witthoeft <troy.witthoeft@gmail.com>
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
import * as WorkbenchUtils from 'sql/workbench/common/sqlWorkbenchUtils';
|
||||
import { TreeNode } from 'sql/workbench/services/objectExplorer/common/treeNode';
|
||||
import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilitiesService';
|
||||
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
|
||||
@@ -14,6 +15,7 @@ import { hash } from 'vs/base/common/hash';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; //TODO: Needed?
|
||||
import { TreeItemCollapsibleState } from 'vs/workbench/common/views';
|
||||
import { localize } from 'vs/nls';
|
||||
import { NodeType } from 'sql/workbench/services/objectExplorer/common/nodeType';
|
||||
@@ -41,7 +43,8 @@ export class OEShimService extends Disposable implements IOEShimService {
|
||||
constructor(
|
||||
@IObjectExplorerService private oe: IObjectExplorerService,
|
||||
@IConnectionManagementService private cm: IConnectionManagementService,
|
||||
@ICapabilitiesService private capabilities: ICapabilitiesService
|
||||
@ICapabilitiesService private capabilities: ICapabilitiesService,
|
||||
@IConfigurationService private configurationService: IConfigurationService
|
||||
) {
|
||||
super();
|
||||
}
|
||||
@@ -133,6 +136,10 @@ export class OEShimService extends Disposable implements IOEShimService {
|
||||
|
||||
public async getChildren(node: ITreeItem, viewId: string): Promise<ITreeItem[]> {
|
||||
if (node.payload) {
|
||||
if (node.payload.authenticationType !== undefined && node.payload.authenticationType === '') {
|
||||
node.payload.authenticationType = this.getDefaultAuthenticationType(this.configurationService); // we need to set auth type here, because it's value is part of the session key
|
||||
}
|
||||
|
||||
const sessionId = await this.getOrCreateSession(viewId, node);
|
||||
const requestHandle = this.nodeHandleMap.get(generateNodeMapKey(viewId, node)) || node.handle;
|
||||
const treeNode = new TreeNode(undefined!, undefined!, undefined!, requestHandle, undefined!); // hack since this entire system is a hack anyways
|
||||
@@ -222,6 +229,10 @@ export class OEShimService extends Disposable implements IOEShimService {
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public getDefaultAuthenticationType(configurationService: IConfigurationService): string {
|
||||
return WorkbenchUtils.getSqlConfigValue<string>(configurationService, 'defaultAuthenticationType');
|
||||
}
|
||||
}
|
||||
|
||||
function generateSessionMapKey(viewId: string, node: ITreeItem): number {
|
||||
|
||||
Reference in New Issue
Block a user