use of org.jetbrains.idea.svn.auth.SvnAuthenticationManager in project intellij-community by JetBrains.
the class SvnConfiguration method getAuthenticationManager.
public SvnAuthenticationManager getAuthenticationManager(@NotNull SvnVcs svnVcs) {
if (myAuthManager == null) {
// reloaded when configuration directory changes
myAuthManager = new SvnAuthenticationManager(svnVcs, new File(getConfigurationDirectory()));
Disposer.register(svnVcs.getProject(), () -> myAuthManager = null);
getInteractiveManager(svnVcs);
// to init
myAuthManager.setAuthenticationProvider(new SvnAuthenticationProvider(svnVcs, myInteractiveProvider, myAuthManager));
myAuthManager.setRuntimeStorage(RUNTIME_AUTH_CACHE);
}
return myAuthManager;
}
use of org.jetbrains.idea.svn.auth.SvnAuthenticationManager in project intellij-community by JetBrains.
the class SvnConfiguration method getInteractiveManager.
public SvnAuthenticationManager getInteractiveManager(@NotNull SvnVcs svnVcs) {
if (myInteractiveManager == null) {
myInteractiveManager = new SvnAuthenticationManager(svnVcs, new File(getConfigurationDirectory()));
myInteractiveManager.setRuntimeStorage(RUNTIME_AUTH_CACHE);
myInteractiveProvider = new SvnInteractiveAuthenticationProvider(svnVcs, myInteractiveManager);
myInteractiveManager.setAuthenticationProvider(myInteractiveProvider);
}
return myInteractiveManager;
}
use of org.jetbrains.idea.svn.auth.SvnAuthenticationManager 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.jetbrains.idea.svn.auth.SvnAuthenticationManager 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;
}
use of org.jetbrains.idea.svn.auth.SvnAuthenticationManager in project intellij-community by JetBrains.
the class SvnProtocolsTest method setUp.
@Override
@Before
public void setUp() throws Exception {
super.setUp();
myVcs = SvnVcs.getInstance(myProject);
// replace authentication provider so that pass credentials without dialogs
final SvnConfiguration configuration = SvnConfiguration.getInstance(myProject);
final SvnAuthenticationManager interactiveManager = configuration.getInteractiveManager(myVcs);
final SvnTestInteractiveAuthentication authentication = new SvnTestInteractiveAuthentication(interactiveManager) {
@Override
public int acceptServerAuthentication(SVNURL url, String realm, Object certificate, boolean resultMayBeStored) {
return ISVNAuthenticationProvider.ACCEPTED;
}
};
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.SSH, o -> new SVNSSHAuthentication(SSH_USER_NAME, SSH_PASSWORD, SSH_PORT_NUMBER, true, o, false));
authentication.addAuthentication(ISVNAuthenticationManager.USERNAME, o -> new SVNUserNameAuthentication(SSH_USER_NAME, true, o, false));
authentication.addAuthentication(ISVNAuthenticationManager.PASSWORD, o -> new SVNPasswordAuthentication("sally", "abcde", true, o, false));
}
Aggregations