Skip to content

Commit 829dfd1

Browse files
committed
fix a bug of saving password
1 parent 614088a commit 829dfd1

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/intellij/secure/IdeaSecureStore.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@
1616
import static com.intellij.credentialStore.CredentialAttributesKt.generateServiceName;
1717

1818
public class IdeaSecureStore implements SecureStore {
19+
private IdeaSecureStore() {
20+
}
21+
22+
// Leverage IntelliJ PasswordSafe component
1923
private PasswordSafe passwordSafe = PasswordSafe.getInstance();
20-
private final CredentialAttributes keysEntry = makeKey("SecureStore", "keys", null);
2124

2225
private static class LazyHolder {
2326
static final IdeaSecureStore INSTANCE = new IdeaSecureStore();
@@ -29,13 +32,6 @@ public static IdeaSecureStore getInstance() {
2932

3033
@Override
3134
public void savePassword(@Nonnull String serviceName, @Nullable String key, @Nullable String userName, @Nonnull String password) {
32-
final String compositeKey = StringUtils.joinWith("|", serviceName, StringUtils.defaultString(key), StringUtils.defaultString(userName));
33-
String savedKeys = passwordSafe.getPassword(keysEntry);
34-
if (StringUtils.contains(savedKeys, compositeKey) && StringUtils.isNotBlank(password)) {
35-
savedKeys = StringUtils.defaultString(savedKeys) + "\n" + compositeKey;
36-
passwordSafe.setPassword(keysEntry, savedKeys);
37-
}
38-
3935
passwordSafe.setPassword(makeKey(serviceName, key, userName), password);
4036
}
4137

0 commit comments

Comments
 (0)