mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
handle default auth type (#20572)
* handle default auth type * comments
This commit is contained in:
@@ -221,7 +221,7 @@ export interface IConnectionManagementService {
|
|||||||
/**
|
/**
|
||||||
* Gets the default authentication type from the configuration service
|
* Gets the default authentication type from the configuration service
|
||||||
*/
|
*/
|
||||||
getDefaultAuthenticationTypeId(): string;
|
getDefaultAuthenticationTypeId(providerName: string): string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cancels the connection
|
* Cancels the connection
|
||||||
|
|||||||
@@ -306,7 +306,7 @@ export class TestConnectionManagementService implements IConnectionManagementSer
|
|||||||
return undefined!;
|
return undefined!;
|
||||||
}
|
}
|
||||||
|
|
||||||
getDefaultAuthenticationTypeId(): string {
|
getDefaultAuthenticationTypeId(providerName: string): string {
|
||||||
return undefined!;
|
return undefined!;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -312,7 +312,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
|||||||
|
|
||||||
// If there is no authentication type set, set it using configuration
|
// If there is no authentication type set, set it using configuration
|
||||||
if (!newConnection.authenticationType || newConnection.authenticationType === '') {
|
if (!newConnection.authenticationType || newConnection.authenticationType === '') {
|
||||||
newConnection.authenticationType = this.getDefaultAuthenticationTypeId();
|
newConnection.authenticationType = this.getDefaultAuthenticationTypeId(newConnection.providerName);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the password is required and still not loaded show the dialog
|
// If the password is required and still not loaded show the dialog
|
||||||
@@ -797,8 +797,11 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
|||||||
return defaultProvider && this._providers.has(defaultProvider) ? defaultProvider : undefined;
|
return defaultProvider && this._providers.has(defaultProvider) ? defaultProvider : undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
public getDefaultAuthenticationTypeId(): string {
|
public getDefaultAuthenticationTypeId(providerName: string): string {
|
||||||
let defaultAuthenticationType = WorkbenchUtils.getSqlConfigValue<string>(this._configurationService, Constants.defaultAuthenticationType);
|
// only return the default authentication type if the provider supports the AuthType option.
|
||||||
|
// Other issues with the implementation is tracked here: https://github.com/microsoft/azuredatastudio/issues/20573
|
||||||
|
const authOption = this._capabilitiesService.getCapabilities(providerName)?.connection.connectionOptions?.find(option => option.specialValueType === ConnectionOptionSpecialType.authType);
|
||||||
|
const defaultAuthenticationType = authOption ? WorkbenchUtils.getSqlConfigValue<string>(this._configurationService, Constants.defaultAuthenticationType) : undefined;
|
||||||
return defaultAuthenticationType;
|
return defaultAuthenticationType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user