mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-161462: master password, part 2
This commit is contained in:
@@ -106,6 +106,7 @@ class PasswordSafeConfigurableUi : ConfigurableUi<PasswordSafeSettings> {
|
||||
}
|
||||
|
||||
settings.providerType = providerType
|
||||
passwordSafe.currentProvider = provider
|
||||
}
|
||||
|
||||
fun updateEnabledState() {
|
||||
|
||||
@@ -24,7 +24,6 @@ import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.components.SettingsSavingComponent
|
||||
import com.intellij.openapi.diagnostic.catchAndLog
|
||||
import org.jetbrains.concurrency.runAsync
|
||||
import java.nio.file.Path
|
||||
|
||||
class PasswordSafeImpl(/* public - backward compatibility */val settings: PasswordSafeSettings) : PasswordSafe(), SettingsSavingComponent {
|
||||
internal @Volatile var currentProvider: PasswordStorage
|
||||
@@ -46,23 +45,6 @@ class PasswordSafeImpl(/* public - backward compatibility */val settings: Passwo
|
||||
}
|
||||
}
|
||||
|
||||
internal fun setProvider(type: ProviderType) {
|
||||
val memoryOnly = type == ProviderType.MEMORY_ONLY
|
||||
if (memoryOnly) {
|
||||
val provider = currentProvider
|
||||
if (provider is KeePassCredentialStore) {
|
||||
provider.memoryOnly = true
|
||||
provider.deleteFileStorage()
|
||||
}
|
||||
else {
|
||||
currentProvider = KeePassCredentialStore(memoryOnly = true)
|
||||
}
|
||||
}
|
||||
else {
|
||||
currentProvider = createPersistentCredentialStore(currentProvider as? KeePassCredentialStore)
|
||||
}
|
||||
}
|
||||
|
||||
override fun get(attributes: CredentialAttributes): Credentials? {
|
||||
val value = currentProvider.get(attributes)
|
||||
if ((value == null || value.password.isNullOrEmpty()) && memoryHelperProvider.isInitialized()) {
|
||||
@@ -119,12 +101,6 @@ class PasswordSafeImpl(/* public - backward compatibility */val settings: Passwo
|
||||
ApplicationManager.getApplication().messageBus.syncPublisher(PasswordSafeSettings.TOPIC).credentialStoreCleared()
|
||||
}
|
||||
|
||||
internal fun getKeePassCredentialStore() = currentProvider as KeePassCredentialStore
|
||||
|
||||
fun importFileDatabase(path: Path, masterPassword: String) {
|
||||
currentProvider = copyFileDatabase(path, masterPassword)
|
||||
}
|
||||
|
||||
override fun isPasswordStoredOnlyInMemory(attributes: CredentialAttributes): Boolean {
|
||||
if (isMemoryOnly) {
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user