public async sanitizeConnectionProfiles()

in src/controllers/mainController.ts [245:276]


	public async sanitizeConnectionProfiles(): Promise<void> {
		const sanitize = async (connectionProfiles: IConnectionProfile[], target: vscode.ConfigurationTarget) => {
			let profileChanged = false;
			for (const conn of connectionProfiles) {
				// remove azure account token
				if (conn && conn.authenticationType !== 'AzureMFA' && conn.azureAccountToken !== undefined) {
					conn.azureAccountToken = undefined;
					profileChanged = true;
				}
				// remove password
				if (!Utils.isEmpty(conn.password)) {
					// save the password in the credential store if save password is true
					await this.connectionManager.connectionStore.saveProfilePasswordIfNeeded(conn);
					conn.password = '';
					profileChanged = true;
				}
			}
			if (profileChanged) {
				await this._vscodeWrapper.setConfiguration(Constants.extensionName, Constants.connectionsArrayName, connectionProfiles, target);
			}
		};
		const profileMapping = new Map<vscode.ConfigurationTarget, IConnectionProfile[]>();
		const configuration = this._vscodeWrapper.getConfiguration(Constants.extensionName, this._vscodeWrapper.activeTextEditorUri);
		const configValue = configuration.inspect<IConnectionProfile[]>(Constants.connectionsArrayName);
		profileMapping.set(vscode.ConfigurationTarget.Global, configValue.globalValue || []);
		profileMapping.set(vscode.ConfigurationTarget.Workspace, configValue.workspaceValue || []);
		profileMapping.set(vscode.ConfigurationTarget.WorkspaceFolder, configValue.workspaceFolderValue || []);
		for (const target of profileMapping.keys()) {
			// sanitize the connections and save them back to their original target.
			await sanitize(profileMapping.get(target), target);
		}
	}