mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
remove password for connection string non sql auth types (#19484)
* remove password for connection string non sql auth types * add comment * fix test
This commit is contained in:
@@ -578,6 +578,12 @@ export async function promptConnectionStringPasswordAndUpdateConnectionString(co
|
|||||||
// or user chooses to not include password (or if user cancels out of include password prompt), or authentication type is not SQL login
|
// or user chooses to not include password (or if user cancels out of include password prompt), or authentication type is not SQL login
|
||||||
connectionString = await vscodeMssqlApi.getConnectionString(connectionDetails, false, false);
|
connectionString = await vscodeMssqlApi.getConnectionString(connectionDetails, false, false);
|
||||||
|
|
||||||
|
if (connectionInfo.authenticationType !== 'SqlLogin') {
|
||||||
|
// temporarily fix until STS is fix to not include the placeholder: https://github.com/microsoft/sqltoolsservice/issues/1508
|
||||||
|
// if authentication type is not SQL login, remove password in connection string
|
||||||
|
connectionString = connectionString.replace(`Password=${constants.passwordPlaceholder};`, '');
|
||||||
|
}
|
||||||
|
|
||||||
if (!connectionInfo.password && connectionInfo.authenticationType === 'SqlLogin') {
|
if (!connectionInfo.password && connectionInfo.authenticationType === 'SqlLogin') {
|
||||||
// if a connection exists but does not have password saved we ask user if they would like to enter it and save it in local.settings.json
|
// if a connection exists but does not have password saved we ask user if they would like to enter it and save it in local.settings.json
|
||||||
userPassword = await vscode.window.showInputBox({
|
userPassword = await vscode.window.showInputBox({
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ describe('Tests to verify Azure Functions Utils functions', function (): void {
|
|||||||
should(quickInputSpy.notCalled).be.true('showInputBox should not have been called');
|
should(quickInputSpy.notCalled).be.true('showInputBox should not have been called');
|
||||||
should(warningSpy.notCalled).be.true('showWarningMessage should not have been called');
|
should(warningSpy.notCalled).be.true('showWarningMessage should not have been called');
|
||||||
// returned connection string should NOT include password
|
// returned connection string should NOT include password
|
||||||
should(getConnectionString).equals(`Server=${connectionInfo.server};Initial Catalog=${connectionInfo.database};User ID=${connectionInfo.user};Password=${constants.passwordPlaceholder};`);
|
should(getConnectionString).equals(`Server=${connectionInfo.server};Initial Catalog=${connectionInfo.database};User ID=${connectionInfo.user};`);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should ask user to enter password and set password to connection string when connection info does not contain password and auth type is SQL', async () => {
|
it('Should ask user to enter password and set password to connection string when connection info does not contain password and auth type is SQL', async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user