From 571b126e8aace2794caaf72646eb59849e7f6b1a Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Tue, 23 Aug 2016 18:28:31 +0200 Subject: [PATCH] accountName -> userName --- platform/credential-store/src/FileCredentialStore.kt | 8 ++++---- platform/credential-store/src/PasswordSafeImpl.kt | 2 +- platform/credential-store/src/dbV1Convertor.kt | 2 +- .../credential-store/src/libraries/linuxSecretLibrary.kt | 6 +++--- .../src/libraries/macOsKeychainLibrary.kt | 6 +++--- .../com/intellij/credentialStore/CredentialAttributes.kt | 4 ++-- .../src/com/intellij/credentialStore/CredentialStore.java | 2 +- .../impl/providers/BasePasswordSafeProvider.java | 2 +- .../ide/passwordSafe/impl/providers/EncryptionUtil.java | 2 +- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/platform/credential-store/src/FileCredentialStore.kt b/platform/credential-store/src/FileCredentialStore.kt index f876a4a0d887..e350d2a4206c 100644 --- a/platform/credential-store/src/FileCredentialStore.kt +++ b/platform/credential-store/src/FileCredentialStore.kt @@ -112,7 +112,7 @@ internal class FileCredentialStore(keyToValue: Map val serviceNamePointer = stringPointer(attributes.serviceName.toByteArray()) - if (attributes.accountName == null) { + if (attributes.userName == null) { LIBRARY.secret_password_lookup_sync(scheme, null, errorRef, serviceAttributeNamePointer, serviceNamePointer, null)?.let { // Secret Service doesn't allow to get attributes, so, we store joined data return splitData(it) @@ -44,7 +44,7 @@ internal class SecretCredentialStore(schemeName: String) : CredentialStore { else { LIBRARY.secret_password_lookup_sync(scheme, null, errorRef, serviceAttributeNamePointer, serviceNamePointer, - accountAttributeNamePointer, stringPointer(attributes.accountName!!.toByteArray()), + accountAttributeNamePointer, stringPointer(attributes.userName!!.toByteArray()), null)?.let { return splitData(it) } @@ -56,7 +56,7 @@ internal class SecretCredentialStore(schemeName: String) : CredentialStore { override fun set(attributes: CredentialAttributes, credentials: Credentials?) { val serviceNamePointer = stringPointer(attributes.serviceName.toByteArray()) - val accountName = attributes.accountName ?: credentials?.userName + val accountName = attributes.userName ?: credentials?.userName if (credentials.isEmpty()) { checkError("secret_password_store_sync") { errorRef -> if (accountName == null) { diff --git a/platform/credential-store/src/libraries/macOsKeychainLibrary.kt b/platform/credential-store/src/libraries/macOsKeychainLibrary.kt index 6536e3fd7b84..956f1c3036ad 100644 --- a/platform/credential-store/src/libraries/macOsKeychainLibrary.kt +++ b/platform/credential-store/src/libraries/macOsKeychainLibrary.kt @@ -37,17 +37,17 @@ private const val kSecAccountItemAttr = (('a'.toInt() shl 8 or 'c'.toInt()) shl internal class KeyChainCredentialStore() : CredentialStore { override fun get(attributes: CredentialAttributes): Credentials? { - return findGenericPassword(attributes.serviceName.toByteArray(), attributes.accountName) + return findGenericPassword(attributes.serviceName.toByteArray(), attributes.userName) } override fun set(attributes: CredentialAttributes, credentials: Credentials?) { if (credentials.isEmpty()) { - deleteGenericPassword(attributes.serviceName.toByteArray(), attributes.accountName!!) + deleteGenericPassword(attributes.serviceName.toByteArray(), attributes.userName!!) return } val password = credentials!!.password!!.toByteArray() - saveGenericPassword(attributes.serviceName.toByteArray(), attributes.accountName ?: credentials.userName, password, password.size) + saveGenericPassword(attributes.serviceName.toByteArray(), attributes.userName ?: credentials.userName, password, password.size) password.fill(0) } } diff --git a/platform/platform-api/src/com/intellij/credentialStore/CredentialAttributes.kt b/platform/platform-api/src/com/intellij/credentialStore/CredentialAttributes.kt index 09cc05255cb5..cc62e1e3a201 100644 --- a/platform/platform-api/src/com/intellij/credentialStore/CredentialAttributes.kt +++ b/platform/platform-api/src/com/intellij/credentialStore/CredentialAttributes.kt @@ -17,7 +17,7 @@ package com.intellij.credentialStore import com.intellij.util.nullize -data class CredentialAttributes(val serviceName: String, val accountName: String? = null) { +data class CredentialAttributes(val serviceName: String, val userName: String? = null) { } // user cannot be empty, but password can be @@ -32,4 +32,4 @@ class Credentials(user: String?, val password: String?) { override fun hashCode() = (userName?.hashCode() ?: 0) * 37 + (password?.hashCode() ?: 0) } -fun CredentialAttributes(requestor: Class<*>, accountName: String) = CredentialAttributes(requestor.name, accountName) \ No newline at end of file +fun CredentialAttributes(requestor: Class<*>, userName: String) = CredentialAttributes(requestor.name, userName) \ No newline at end of file diff --git a/platform/platform-api/src/com/intellij/credentialStore/CredentialStore.java b/platform/platform-api/src/com/intellij/credentialStore/CredentialStore.java index 22126f088179..ebe058170e99 100644 --- a/platform/platform-api/src/com/intellij/credentialStore/CredentialStore.java +++ b/platform/platform-api/src/com/intellij/credentialStore/CredentialStore.java @@ -31,6 +31,6 @@ public interface CredentialStore { void set(@NotNull CredentialAttributes attributes, @Nullable Credentials credentials); default void setPassword(@NotNull CredentialAttributes attributes, @Nullable String password) { - set(attributes, password == null ? null : new Credentials(attributes.getAccountName(), password)); + set(attributes, password == null ? null : new Credentials(attributes.getUserName(), password)); } } diff --git a/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/BasePasswordSafeProvider.java b/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/BasePasswordSafeProvider.java index 62288804e0c7..a0f23be7f75b 100644 --- a/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/BasePasswordSafeProvider.java +++ b/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/BasePasswordSafeProvider.java @@ -33,7 +33,7 @@ public abstract class BasePasswordSafeProvider implements PasswordStorage { byte[] masterKey = key(); byte[] encryptedPassword = getEncryptedPassword(EncryptionUtil.encryptKey(masterKey, EncryptionUtil.rawKey(attributes))); String password = encryptedPassword == null ? null : EncryptionUtil.decryptText(masterKey, encryptedPassword); - return password == null ? null : new Credentials(attributes.getAccountName(), password); + return password == null ? null : new Credentials(attributes.getUserName(), password); } protected abstract byte[] getEncryptedPassword(@NotNull byte[] key); diff --git a/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/EncryptionUtil.java b/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/EncryptionUtil.java index 69807314ee80..e200122e31f7 100644 --- a/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/EncryptionUtil.java +++ b/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/EncryptionUtil.java @@ -76,7 +76,7 @@ public class EncryptionUtil { } static byte[] rawKey(@NotNull CredentialAttributes attributes) { - return hash(getUTF8Bytes(attributes.getServiceName() + "/" + attributes.getAccountName())); + return hash(getUTF8Bytes(attributes.getServiceName() + "/" + attributes.getUserName())); } /**