Add support for AAD interactive connection strings for project data sources (#11761)

* add support for AAD interactive for project data sources

* fix whitespace

* remove warning message

* choose azureMFA if a connection string has both integrated security=true and authentication=active directory interactive
This commit is contained in:
Kim Santiago
2020-08-14 16:13:22 -07:00
committed by GitHub
parent a34a72795b
commit 3b2e53d270
6 changed files with 38 additions and 6 deletions

View File

@@ -35,7 +35,21 @@ export class SqlConnectionDataSource extends DataSource {
}
public get integratedSecurity(): boolean {
return this.getSetting(constants.integratedSecuritySetting).toLowerCase() === 'true';
return this.getSetting(constants.integratedSecuritySetting)?.toLowerCase() === 'true';
}
public get azureMFA(): boolean {
return this.getSetting(constants.authenticationSetting)?.toLowerCase().includes(constants.activeDirectoryInteractive);
}
public get authType(): string {
if (this.azureMFA) {
return constants.azureMfaAuth;
} else if (this.integratedSecurity) {
return constants.integratedAuth;
} else {
return constants.sqlAuth;
}
}
public get username(): string {
@@ -79,7 +93,7 @@ export class SqlConnectionDataSource extends DataSource {
connectionName: this.name,
userName: this.username,
password: this.password,
authenticationType: this.integratedSecurity ? 'Integrated' : 'SqlAuth',
authenticationType: this.authType,
savePassword: false,
providerName: 'MSSQL',
saveProfile: true,