diff options
Diffstat (limited to 'appc-adapters/appc-ssh-adapter/appc-ssh-adapter-sshd')
2 files changed, 10 insertions, 6 deletions
diff --git a/appc-adapters/appc-ssh-adapter/appc-ssh-adapter-sshd/src/main/java/org/onap/appc/adapter/ssh/sshd/SshAdapterSshd.java b/appc-adapters/appc-ssh-adapter/appc-ssh-adapter-sshd/src/main/java/org/onap/appc/adapter/ssh/sshd/SshAdapterSshd.java index 209aa1f9a..2b5b6806a 100644 --- a/appc-adapters/appc-ssh-adapter/appc-ssh-adapter-sshd/src/main/java/org/onap/appc/adapter/ssh/sshd/SshAdapterSshd.java +++ b/appc-adapters/appc-ssh-adapter/appc-ssh-adapter-sshd/src/main/java/org/onap/appc/adapter/ssh/sshd/SshAdapterSshd.java @@ -28,8 +28,13 @@ import org.onap.appc.adapter.ssh.SshConnection; public class SshAdapterSshd implements SshAdapter { - @Override - public SshConnection getConnection(String host, int port, String username, String password) { - return new SshConnectionSshd(host, port, username, password); - } + @Override + public SshConnection getConnection(String host, int port, String username, String password) { + return new SshConnectionSshd(host, port, username, password); + } + + @Override + public SshConnection getConnection(String host, int port, String keyFile) { + return new SshConnectionSshd(host, port, keyFile); + } } diff --git a/appc-adapters/appc-ssh-adapter/appc-ssh-adapter-sshd/src/main/java/org/onap/appc/adapter/ssh/sshd/SshConnectionSshd.java b/appc-adapters/appc-ssh-adapter/appc-ssh-adapter-sshd/src/main/java/org/onap/appc/adapter/ssh/sshd/SshConnectionSshd.java index d54fe4355..299ad7755 100644 --- a/appc-adapters/appc-ssh-adapter/appc-ssh-adapter-sshd/src/main/java/org/onap/appc/adapter/ssh/sshd/SshConnectionSshd.java +++ b/appc-adapters/appc-ssh-adapter/appc-ssh-adapter-sshd/src/main/java/org/onap/appc/adapter/ssh/sshd/SshConnectionSshd.java @@ -91,8 +91,7 @@ class SshConnectionSshd implements SshConnection { sshClient.connect(EncryptionTool.getInstance().decrypt(username), host, port).verify().getSession(); if (password != null) { clientSession.addPasswordIdentity(EncryptionTool.getInstance().decrypt(password)); - } - if (keyFile != null) { + } else if (keyFile != null) { KeyPairProvider keyPairProvider = new FileKeyPairProvider( new File(keyFile).toPath() ); |