//Iterator it2 = null;
java.util.List selected;
// Loop until the user either cancels or completes
boolean completed = false;
SshAuthenticationClient auth;
Map.Entry entry;
String msg = null;
while (!completed &&
(ssh.getConnectionState().getValue() != TransportProtocolState.DISCONNECTED)) {
auth = null;
// Select an authentication method from the properties file or
// prompt the user to choose
if (it.hasNext()) {
Object obj = it.next();
if (obj instanceof Map.Entry) {
entry = (Map.Entry) obj;
auth = (SshAuthenticationClient) entry.getValue();
} else if (obj instanceof String) {
auth = SshAuthenticationClientFactory.newInstance((String) obj);
auth.setUsername(getCurrentConnectionProfile().getUsername());
} else {
closeConnection(true);
throw new IOException(
"Iterator of Map or List of String expected");
}
} else {
selected = AuthenticationDialog.showAuthenticationDialog(this,
display, ((msg == null) ? "" : msg));
if (selected.size() > 0) {
it = selected.iterator();
} else {
closeConnection(true);
return false;
}
}
if (auth != null) {
// The password authentication client can act upon requests to change the password
/* if (auth instanceof PasswordAuthenticationClient) {
PasswordAuthenticationDialog dialog = new PasswordAuthenticationDialog(SshTerminalPanel.this);
((PasswordAuthenticationClient) auth).setAuthenticationPrompt(dialog);
( (PasswordAuthenticationClient) auth)
.setPasswordChangePrompt(PasswordChange.getInstance());
PasswordChange.getInstance().setParentComponent(
SshTerminalPanel.this);
}*/
// Show the implementations dialog
// if(auth.showAuthenticationDialog()) {
// Authentication with the details supplied
result = showAuthenticationPrompt(auth); //ssh.authenticate(auth);
if (result == AuthenticationProtocolState.FAILED) {
msg = auth.getMethodName() +
" authentication failed, try again?";
}
// If the result returned partial success then continue
if (result == AuthenticationProtocolState.PARTIAL) {
// We succeeded so add to the connections authenticaiton
// list and continue on to the next one
getCurrentConnectionProfile().addAuthenticationMethod(auth);
msg = auth.getMethodName() +
" authentication succeeded but another is required";
}
if (result == AuthenticationProtocolState.COMPLETE) {
authenticated = true;