X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-ssh%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fssh%2Fauthentication%2FSSHServerTest.java;h=1151abcdf2767de1aa5a70fd19aa3219f9b23b1c;hb=99a0b01f27126a17ec2af165cf3fd9e53c977d2b;hp=5e368bc5669f7ce88318971cb810722e7c7f8d49;hpb=8dd063e01eda1ce8f8c3cf0b49af17d6dfff388e;p=controller.git 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 5e368bc566..1151abcdf2 100644 --- 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.opendaylight.controller.netconf.StubUserManager; +import org.opendaylight.controller.netconf.auth.AuthProvider; 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"); - StubUserManager um = new StubUserManager(USER, PASSWORD); 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(), - 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);