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-1617 Extract AuthProvider from netconf ssh"
[controller.git]
/
opendaylight
/
netconf
/
netconf-ssh
/
src
/
test
/
java
/
org
/
opendaylight
/
controller
/
netconf
/
ssh
/
authentication
/
SSHServerTest.java
diff --git
a/opendaylight/netconf/netconf-ssh/src/test/java/org/opendaylight/controller/netconf/ssh/authentication/SSHServerTest.java
b/opendaylight/netconf/netconf-ssh/src/test/java/org/opendaylight/controller/netconf/ssh/authentication/SSHServerTest.java
index 5e368bc5669f7ce88318971cb810722e7c7f8d49..1151abcdf2767de1aa5a70fd19aa3219f9b23b1c 100644
(file)
--- a/
opendaylight/netconf/netconf-ssh/src/test/java/org/opendaylight/controller/netconf/ssh/authentication/SSHServerTest.java
+++ b/
opendaylight/netconf/netconf-ssh/src/test/java/org/opendaylight/controller/netconf/ssh/authentication/SSHServerTest.java
@@
-23,7
+23,7
@@
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import org.opendaylight.controller.netconf.
StubUserManag
er;
+import org.opendaylight.controller.netconf.
auth.AuthProvid
er;
import org.opendaylight.controller.netconf.ssh.NetconfSSHServer;
import org.opendaylight.controller.netconf.util.osgi.NetconfConfigUtil;
import org.osgi.framework.BundleContext;
import org.opendaylight.controller.netconf.ssh.NetconfSSHServer;
import org.opendaylight.controller.netconf.util.osgi.NetconfConfigUtil;
import org.osgi.framework.BundleContext;
@@
-55,16
+55,21
@@
public class SSHServerTest {
doReturn(new ServiceReference[0]).when(mockedContext).getServiceReferences(anyString(), anyString());
logger.info("Creating SSH server");
doReturn(new ServiceReference[0]).when(mockedContext).getServiceReferences(anyString(), anyString());
logger.info("Creating SSH server");
- StubUserManager um = new StubUserManager(USER, PASSWORD);
String pem;
try (InputStream is = getClass().getResourceAsStream("/RSA.pk")) {
pem = IOUtils.toString(is);
}
String pem;
try (InputStream is = getClass().getResourceAsStream("/RSA.pk")) {
pem = IOUtils.toString(is);
}
- AuthProvider ap = new AuthProvider(pem, mockedContext);
- ap.setNullableUserManager(um);
+
+
EventLoopGroup bossGroup = new NioEventLoopGroup();
NetconfSSHServer server = NetconfSSHServer.start(PORT, NetconfConfigUtil.getNetconfLocalAddress(),
EventLoopGroup bossGroup = new NioEventLoopGroup();
NetconfSSHServer server = NetconfSSHServer.start(PORT, NetconfConfigUtil.getNetconfLocalAddress(),
- ap, bossGroup);
+ bossGroup, pem.toCharArray());
+ server.setAuthProvider(new AuthProvider() {
+ @Override
+ public boolean authenticated(final String username, final String password) {
+ return true;
+ }
+ });
sshServerThread = new Thread(server);
sshServerThread.setDaemon(true);
sshServerThread = new Thread(server);
sshServerThread.setDaemon(true);