throw new IOException("Login aborted by user");
File keyFile = new File(kd.getFile());
if (keyFile.exists()) {
final EnterInputDialog esd = new EnterInputDialog(JSimLogic
.getInstance().getFrame(), "Key Authentication",
new String[] { "Enter private key password" }, true);
esd.setLocationRelativeTo(JSimLogic.getInstance().getFrame());
esd.setVisible(true);
if (esd.getAnswer() == null)
throw new IOException("Login aborted by user");
success = conn.authenticateWithPublicKey(
rProject.getUsername(), keyFile, esd.getAnswer());
}
} else if (conn.isAuthMethodAvailable(rProject.getUsername(),
"keyboard-interactive")) {
InteractiveLogic il = new InteractiveLogic();
success = conn.authenticateWithKeyboardInteractive(rProject
.getUsername(), il);
if (il.getPromptCount() == 0)
throw new IOException("Keyboard-interactive does not work.");
} else if (conn.isAuthMethodAvailable(rProject.getUsername(),
"password")) {
final EnterInputDialog esd = new EnterInputDialog(JSimLogic
.getInstance().getFrame(), "Password Authentication",
new String[] { "Enter password for "
+ rProject.getUsername() }, true);
esd.setLocationRelativeTo(JSimLogic.getInstance().getFrame());
esd.setVisible(true);
if (esd.getAnswer() == null)
throw new IOException("Login aborted by user");
success = conn.authenticateWithPassword(rProject.getUsername(), esd
.getAnswer());
}
if (!success)
throw new IOException("Authentication failed");