X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-netty-util%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fnettyutil%2Fhandler%2Fssh%2Fauthentication%2FLoginPassword.java;h=553e5359ffed1cd8b5728734bb5546e3abb0f72e;hb=30712afec4c80c7f3a49788a8f52d27611605698;hp=b67aa0f96dcd53a084965fc3766399a26f2a5869;hpb=17d82f582a6bc13c78be3b19954ff8c021180e93;p=controller.git diff --git a/opendaylight/netconf/netconf-netty-util/src/main/java/org/opendaylight/controller/netconf/nettyutil/handler/ssh/authentication/LoginPassword.java b/opendaylight/netconf/netconf-netty-util/src/main/java/org/opendaylight/controller/netconf/nettyutil/handler/ssh/authentication/LoginPassword.java index b67aa0f96d..553e5359ff 100644 --- a/opendaylight/netconf/netconf-netty-util/src/main/java/org/opendaylight/controller/netconf/nettyutil/handler/ssh/authentication/LoginPassword.java +++ b/opendaylight/netconf/netconf-netty-util/src/main/java/org/opendaylight/controller/netconf/nettyutil/handler/ssh/authentication/LoginPassword.java @@ -8,10 +8,13 @@ package org.opendaylight.controller.netconf.nettyutil.handler.ssh.authentication; -import ch.ethz.ssh2.Connection; - import java.io.IOException; +import org.apache.sshd.ClientSession; +import org.apache.sshd.client.future.AuthFuture; + +import ch.ethz.ssh2.Connection; + /** * Class Providing username/password authentication option to * {@link org.opendaylight.controller.netconf.nettyutil.handler.ssh.client.SshHandler} @@ -27,10 +30,21 @@ public class LoginPassword extends AuthenticationHandler { @Override public void authenticate(Connection connection) throws IOException { - boolean isAuthenticated = connection.authenticateWithPassword(username, password); + final boolean isAuthenticated = connection.authenticateWithPassword(username, password); if (!isAuthenticated) { throw new IOException("Authentication failed."); } } + + @Override + public String getUsername() { + return username; + } + + @Override + public AuthFuture authenticate(final ClientSession session) throws IOException { + session.addPasswordIdentity(password); + return session.auth(); + } }