Use ssh agent if privatekey and password are not set

This commit is contained in:
Huy TA 2015-04-24 16:57:33 +10:00 committed by Ignasi Barrera
parent b1231257fd
commit 522c080a4a
1 changed files with 1 additions and 1 deletions

View File

@ -169,7 +169,7 @@ public final class SessionConnection implements Connection<Session> {
.getSession(loginCredentials.getUser(), hostAndPort.getHostText(), hostAndPort.getPortOrDefault(22));
if (sessionTimeout != 0)
session.setTimeout(sessionTimeout);
if (!loginCredentials.getOptionalPrivateKey().isPresent()) {
if (loginCredentials.getOptionalPassword().isPresent()) {
session.setPassword(loginCredentials.getOptionalPassword().orNull());
} else if (loginCredentials.hasUnencryptedPrivateKey()) {
byte[] privateKey = loginCredentials.getOptionalPrivateKey().get().getBytes();