Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Merge "Bug 1234: Force to use legacy OF plugin if it is installed."
[controller.git]
/
opendaylight
/
netconf
/
netconf-netty-util
/
src
/
main
/
java
/
org
/
opendaylight
/
controller
/
netconf
/
nettyutil
/
handler
/
ssh
/
authentication
/
LoginPassword.java
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 67027d8014881f7b1286a2eb6229ae3258a32a8a..553e5359ffed1cd8b5728734bb5546e3abb0f72e 100644
(file)
--- 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,13
+8,16
@@
package org.opendaylight.controller.netconf.nettyutil.handler.ssh.authentication;
package org.opendaylight.controller.netconf.nettyutil.handler.ssh.authentication;
-import ch.ethz.ssh2.Connection;
-
import java.io.IOException;
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
/**
* Class Providing username/password authentication option to
- * {@link org.opendaylight.controller.netconf.nettyutil.handler.ssh.SshHandler}
+ * {@link org.opendaylight.controller.netconf.nettyutil.handler.ssh.
client.
SshHandler}
*/
public class LoginPassword extends AuthenticationHandler {
private final String username;
*/
public class LoginPassword extends AuthenticationHandler {
private final String username;
@@
-27,10
+30,21
@@
public class LoginPassword extends AuthenticationHandler {
@Override
public void authenticate(Connection connection) throws IOException {
@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.");
}
}
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();
+ }
}
}