From bb622e31949104d9a9b16c64e77a8b104a2f2fc3 Mon Sep 17 00:00:00 2001 From: Irina Chernushina Date: Sat, 1 Aug 2009 20:48:45 +0400 Subject: [PATCH] SVN: IDEA-23821 (Intellij deletes client certificates from ~/.svn/) --- .../src/org/jetbrains/idea/svn/SvnConfiguration.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfiguration.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfiguration.java index d83922f63e..9a03df9bf8 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfiguration.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfiguration.java @@ -58,6 +58,7 @@ import org.tmatesoft.svn.core.wc.ISVNOptions; import org.tmatesoft.svn.core.wc.SVNWCUtil; import java.io.File; +import java.io.FilenameFilter; import java.util.*; public class SvnConfiguration implements ProjectComponent, JDOMExternalizable { @@ -408,6 +409,9 @@ public class SvnConfiguration implements ProjectComponent, JDOMExternalizable { return Collections.unmodifiableMap(myUpdateRootInfos); } + private static final List ourAuthKinds = Arrays.asList(ISVNAuthenticationManager.PASSWORD, ISVNAuthenticationManager.SSH, + ISVNAuthenticationManager.SSL, ISVNAuthenticationManager.USERNAME, "svn.ssl.server"); + public void clearAuthenticationDirectory() { final File authDir = new File(getConfigurationDirectory(), "auth"); if (authDir.exists()) { @@ -416,8 +420,19 @@ public class SvnConfiguration implements ProjectComponent, JDOMExternalizable { final ProgressIndicator ind = ProgressManager.getInstance().getProgressIndicator(); if (ind != null) { ind.setIndeterminate(true); - ind.setText("Deleting " + authDir.getAbsolutePath()); - FileUtil.delete(authDir); + ind.setText("Clearing stored credentials in " + authDir.getAbsolutePath()); + } + final File[] files = authDir.listFiles(new FilenameFilter() { + public boolean accept(File dir, String name) { + return ourAuthKinds.contains(name); + } + }); + + for (File dir : files) { + if (ind != null) { + ind.setText("Deleting " + dir.getAbsolutePath()); + } + FileUtil.delete(dir); } } }, "button.text.clear.authentication.cache", false, myProject); -- 2.11.4.GIT