IDEA-65604 Subversion SSH: CCE at org.jetbrains.idea.svn.SvnAuthenticationManager$IdeaSVNHostOptions$2.get

This commit is contained in:
irengrig
2011-02-16 18:51:50 +03:00
parent 38d051a572
commit 331a63b056
3 changed files with 18 additions and 9 deletions
@@ -40,10 +40,7 @@ import org.tmatesoft.svn.core.SVNErrorMessage;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNProperties;
import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.auth.ISVNAuthenticationProvider;
import org.tmatesoft.svn.core.auth.ISVNProxyManager;
import org.tmatesoft.svn.core.auth.SVNAuthentication;
import org.tmatesoft.svn.core.auth.SVNSSLAuthentication;
import org.tmatesoft.svn.core.auth.*;
import org.tmatesoft.svn.core.internal.wc.*;
import org.tmatesoft.svn.core.io.SVNRepository;
@@ -568,8 +565,9 @@ public class SvnAuthenticationManager extends DefaultSVNAuthenticationManager im
}
@Override
public boolean promptForSSLPlaintextPassphraseSaving(SVNURL url, String realm, File certificateFile) {
final int answer = Messages.showYesNoDialog(myProject, String.format("Your passphrase for client certificate:\n%s\ncan only be stored to disk unencrypted. Would you like to store it in plaintext?",
public boolean promptForSSLPlaintextPassphraseSaving(SVNURL url, String realm, File certificateFile, String certificateName) {
final int answer = Messages.showYesNoDialog(myProject,
String.format("Your passphrase for " + certificateName + ":\n%s\ncan only be stored to disk unencrypted. Would you like to store it in plaintext?",
certificateFile.getPath()),
"Store the passphrase in plaintext?", Messages.getQuestionIcon());
return answer == 0;
@@ -655,8 +653,19 @@ public class SvnAuthenticationManager extends DefaultSVNAuthenticationManager im
promptAndSaveWhenWeLackEncryption(realm, auth, new Getter<Boolean>() {
@Override
public Boolean get() {
File file = null;
String certificateName = null;
if (auth instanceof SVNSSLAuthentication) {
file = ((SVNSSLAuthentication) auth).getCertificateFile();
certificateName = "client certificate";
} else if (auth instanceof SVNSSHAuthentication) {
file = ((SVNSSHAuthentication) auth).getPrivateKeyFile();
certificateName = "private key file";
} else {
assert false;
}
return myInteraction.promptForSSLPlaintextPassphraseSaving(myUrl, realm,
((SVNSSLAuthentication) auth).getCertificateFile());
file, certificateName);
}
});
}
@@ -23,7 +23,7 @@ public interface SvnAuthenticationInteraction {
void warnOnAuthStorageDisabled(final SVNURL url);
void warnOnPasswordStorageDisabled(final SVNURL url);
void warnOnSSLPassphraseStorageDisabled(final SVNURL url);
boolean promptForSSLPlaintextPassphraseSaving(final SVNURL url, String realm, File certificateFile);
boolean promptForSSLPlaintextPassphraseSaving(final SVNURL url, String realm, File certificateFile, String certificateName);
boolean promptForPlaintextPasswordSaving(final SVNURL url, String realm);
boolean promptInAwt();
}
@@ -1248,7 +1248,7 @@ public class SvnAuthenticationTest extends PlatformTestCase {
}
@Override
public boolean promptForSSLPlaintextPassphraseSaving(SVNURL url, String realm, File certificateFile) {
public boolean promptForSSLPlaintextPassphraseSaving(SVNURL url, String realm, File certificateFile, String certificateName) {
++ myNumSSLPlaintextPrompt;
return mySSLPlaintextAnswer;
}