mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Use utility method to generate canonical CredentialAttributes service name
This commit is contained in:
@@ -28,6 +28,8 @@ import java.util.concurrent.atomic.AtomicReference
|
||||
|
||||
const val SERVICE_NAME_PREFIX = "IntelliJ Platform"
|
||||
|
||||
fun generateServiceName(subsystem: String, key: String) = "$SERVICE_NAME_PREFIX $subsystem — $key"
|
||||
|
||||
/**
|
||||
* requestor is deprecated. Never use it in new code.
|
||||
*/
|
||||
|
||||
@@ -156,6 +156,6 @@ class HgCommandAuthenticator {
|
||||
|
||||
@NotNull
|
||||
private static CredentialAttributes createCredentialAttributes(@NotNull String url) {
|
||||
return new CredentialAttributes(CredentialAttributesKt.SERVICE_NAME_PREFIX + " HG — " + url, null);
|
||||
return new CredentialAttributes(CredentialAttributesKt.generateServiceName("HG", url), null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ package org.jetbrains.settingsRepository
|
||||
|
||||
import com.intellij.credentialStore.CredentialAttributes
|
||||
import com.intellij.credentialStore.Credentials
|
||||
import com.intellij.credentialStore.SERVICE_NAME_PREFIX
|
||||
import com.intellij.credentialStore.generateServiceName
|
||||
import com.intellij.ide.passwordSafe.PasswordSafe
|
||||
|
||||
/**
|
||||
@@ -34,7 +34,7 @@ class IcsCredentialsStore() {
|
||||
|
||||
private fun CredentialAttributes(host: String?, sshKeyFile: String?, accountName: String?): CredentialAttributes? {
|
||||
if (sshKeyFile == null) {
|
||||
return CredentialAttributes("$SERVICE_NAME_PREFIX Settings Repository — $host", accountName)
|
||||
return CredentialAttributes(generateServiceName("Settings Repository", host.toString()), accountName)
|
||||
}
|
||||
else {
|
||||
return CredentialAttributes("SSH", sshKeyFile)
|
||||
|
||||
Reference in New Issue
Block a user