} else if (loginCredentials.hasUnencryptedPrivateKey()) {
OpenSSHKeyFile key = new OpenSSHKeyFile();
key.init(loginCredentials.getOptionalPrivateKey().get(), null);
ssh.authPublickey(loginCredentials.getUser(), key);
} else if (agentConnector.isPresent()) {
AgentProxy proxy = new AgentProxy(agentConnector.get());
ssh.auth(loginCredentials.getUser(), getAuthMethods(proxy));
}
return ssh;
}