mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-27 09:35:37 -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:
@@ -152,6 +152,16 @@ export class ConnectionDialogService implements IConnectionDialogService {
|
||||
return defaultProvider || Constants.mssqlProviderName;
|
||||
}
|
||||
|
||||
private getDefaultAuthenticationTypeName(): string {
|
||||
let defaultAuthenticationType: string;
|
||||
if (!defaultAuthenticationType && this._configurationService) {
|
||||
defaultAuthenticationType = WorkbenchUtils.getSqlConfigValue<string>(this._configurationService, Constants.defaultAuthenticationType);
|
||||
}
|
||||
|
||||
return defaultAuthenticationType || Constants.sqlLogin; // as a fallback, default to sql login if the value from settings is not available
|
||||
|
||||
}
|
||||
|
||||
private handleOnConnect(params: INewConnectionParams, profile?: IConnectionProfile): void {
|
||||
this._logService.debug('ConnectionDialogService: onConnect event is received');
|
||||
if (!this._connecting) {
|
||||
@@ -383,6 +393,14 @@ export class ConnectionDialogService implements IConnectionDialogService {
|
||||
if (model && !model.providerName) {
|
||||
model.providerName = providerName;
|
||||
}
|
||||
|
||||
const defaultAuthenticationType = this.getDefaultAuthenticationTypeName();
|
||||
let authenticationTypeName = model ? model.authenticationType : defaultAuthenticationType;
|
||||
authenticationTypeName = authenticationTypeName ? authenticationTypeName : defaultAuthenticationType;
|
||||
if (model && !model.authenticationType) {
|
||||
model.authenticationType = authenticationTypeName;
|
||||
}
|
||||
|
||||
let newProfile = new ConnectionProfile(this._capabilitiesService, model || providerName);
|
||||
newProfile.saveProfile = true;
|
||||
newProfile.generateNewId();
|
||||
|
||||
Reference in New Issue
Block a user