aboutsummaryrefslogtreecommitdiffstats
path: root/appc-adapters/appc-ssh-adapter/appc-ssh-adapter-sshd/src
diff options
context:
space:
mode:
authorGanesh Chandrasekaran <ganesh.c@samsung.com>2018-07-20 16:32:46 +0900
committerPatrick Brady <pb071s@att.com>2018-07-26 21:47:39 +0000
commit14175c4605745183a09dcd0fdc72c0d4e8a05b20 (patch)
tree0fa5e27c0207cc3da30f4acf3af9bc1020bff4aa /appc-adapters/appc-ssh-adapter/appc-ssh-adapter-sshd/src
parentfdf7e648663e5770a431e9ba8088be6c3bbf1f5a (diff)
API to support getConnection with SSH KeyFile
Issue-ID: APPC-1097 Change-Id: Ic9baa3e43be55bc20aa974898c164cc8a590a78a Signed-off-by: Ganesh Chandrasekaran <ganesh.c@samsung.com>
Diffstat (limited to 'appc-adapters/appc-ssh-adapter/appc-ssh-adapter-sshd/src')
-rw-r--r--appc-adapters/appc-ssh-adapter/appc-ssh-adapter-sshd/src/main/java/org/onap/appc/adapter/ssh/sshd/SshAdapterSshd.java13
-rw-r--r--appc-adapters/appc-ssh-adapter/appc-ssh-adapter-sshd/src/main/java/org/onap/appc/adapter/ssh/sshd/SshConnectionSshd.java3
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()
);