use of org.tmatesoft.svn.core.SVNErrorMessage in project intellij-community by JetBrains.
the class SvnUtil method parseWarning.
@Nullable
public static SVNErrorMessage parseWarning(@NotNull String text) {
Matcher matcher = WARNING_PATTERN.matcher(text);
SVNErrorMessage error = null;
// currently treating only first warning
if (matcher.find()) {
error = SVNErrorMessage.create(SVNErrorCode.getErrorCode(Integer.parseInt(matcher.group(2))), matcher.group(3), SVNErrorMessage.TYPE_WARNING);
}
return error;
}
use of org.tmatesoft.svn.core.SVNErrorMessage in project intellij-community by JetBrains.
the class SvnConfiguration method getPassiveAuthenticationManager.
public SvnAuthenticationManager getPassiveAuthenticationManager(@NotNull SvnVcs svnVcs) {
if (myPassiveAuthManager == null) {
myPassiveAuthManager = new SvnAuthenticationManager(svnVcs, new File(getConfigurationDirectory()));
myPassiveAuthManager.setAuthenticationProvider(new ISVNAuthenticationProvider() {
@Override
public SVNAuthentication requestClientAuthentication(String kind, SVNURL url, String realm, SVNErrorMessage errorMessage, SVNAuthentication previousAuth, boolean authMayBeStored) {
return null;
}
@Override
public int acceptServerAuthentication(SVNURL url, String realm, Object certificate, boolean resultMayBeStored) {
return REJECTED;
}
});
myPassiveAuthManager.setRuntimeStorage(RUNTIME_AUTH_CACHE);
}
return myPassiveAuthManager;
}
use of org.tmatesoft.svn.core.SVNErrorMessage in project intellij-community by JetBrains.
the class SvnNativeClientAuthTest method setUp.
@Override
@Before
public void setUp() throws Exception {
super.setUp();
final File certFile = new File(myPluginRoot, getTestDataDir() + "/svn/____.pfx");
setNativeAcceleration(true);
myVcs = SvnVcs.getInstance(myProject);
// replace authentication provider so that pass credentials without dialogs
final SvnConfiguration configuration = SvnConfiguration.getInstance(myProject);
final File svnconfig = FileUtil.createTempDirectory("svnconfig", "");
configuration.setConfigurationDirParameters(false, svnconfig.getPath());
final SvnAuthenticationManager interactiveManager = configuration.getInteractiveManager(myVcs);
final SvnTestInteractiveAuthentication authentication = new SvnTestInteractiveAuthentication(interactiveManager) {
@Override
public int acceptServerAuthentication(SVNURL url, String realm, Object certificate, boolean resultMayBeStored) {
++myCertificateAskedInteractivelyCount;
return myCertificateAnswer;
}
@Override
public SVNAuthentication requestClientAuthentication(String kind, SVNURL url, String realm, SVNErrorMessage errorMessage, SVNAuthentication previousAuth, boolean authMayBeStored) {
if (myCancelAuth)
return null;
return super.requestClientAuthentication(kind, url, realm, errorMessage, previousAuth, authMayBeStored);
}
};
interactiveManager.setAuthenticationProvider(authentication);
final SvnAuthenticationManager manager = configuration.getAuthenticationManager(myVcs);
// will be the same as in interactive -> authentication notifier is not used
manager.setAuthenticationProvider(authentication);
authentication.addAuthentication(ISVNAuthenticationManager.PASSWORD, o -> {
++myCredentialsAskedInteractivelyCount;
if (myCancelAuth)
return null;
if (myCredentialsCorrect) {
return new SVNPasswordAuthentication(outHttpUser, outHttpPassword, mySaveCredentials, o, false);
} else {
myCredentialsCorrect = true;
return new SVNPasswordAuthentication("1234214 23 4234", "324324", mySaveCredentials, o, false);
}
});
authentication.addAuthentication(ISVNAuthenticationManager.SSL, o -> {
++myCredentialsAskedInteractivelyCount;
if (myCancelAuth)
return null;
if (myCredentialsCorrect) {
return new SVNSSLAuthentication(certFile, "12345", mySaveCredentials, o, false);
} else {
myCredentialsCorrect = true;
return new SVNSSLAuthentication(new File("1232432423"), "3245321532534235445", mySaveCredentials, o, false);
}
});
myCertificateAskedInteractivelyCount = 0;
myCredentialsAskedInteractivelyCount = 0;
}
Aggregations