IDEA-161462: master password, part 2

This commit is contained in:
Vladimir Krivosheev
2016-10-24 11:57:26 +02:00
parent 232cd83cd6
commit 2f43d0f4e3
2 changed files with 1 additions and 24 deletions
@@ -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