diff options
author | Florian Zschocke <florian.zschocke@devolo.de> | 2019-11-08 19:19:54 +0100 |
---|---|---|
committer | Florian Zschocke <florian.zschocke@devolo.de> | 2019-11-10 13:03:20 +0100 |
commit | 15dda8f5c6238710626e1091d4c98fe457d55d4d (patch) | |
tree | e6846eaa4c91cce53cb06055d4c7424cfa5bc6a0 /src/test/java | |
parent | abb041d2035e36c23191cf3c71640839e7708f8d (diff) | |
download | gitblit-15dda8f5c6238710626e1091d4c98fe457d55d4d.tar.gz gitblit-15dda8f5c6238710626e1091d4c98fe457d55d4d.zip |
Update SSHD dependency to version 1.2.0.
Diffstat (limited to 'src/test/java')
-rw-r--r-- | src/test/java/com/gitblit/tests/SshUnitTest.java | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/test/java/com/gitblit/tests/SshUnitTest.java b/src/test/java/com/gitblit/tests/SshUnitTest.java index dd354d85..075ab43a 100644 --- a/src/test/java/com/gitblit/tests/SshUnitTest.java +++ b/src/test/java/com/gitblit/tests/SshUnitTest.java @@ -21,6 +21,7 @@ import java.io.IOException; import java.io.OutputStreamWriter; import java.io.Writer; import java.net.SocketAddress; +import java.security.GeneralSecurityException; import java.security.KeyPair; import java.security.KeyPairGenerator; import java.security.PublicKey; @@ -29,9 +30,12 @@ import java.util.concurrent.atomic.AtomicBoolean; import org.apache.sshd.client.SshClient; import org.apache.sshd.client.channel.ClientChannel; +import org.apache.sshd.client.channel.ClientChannelEvent; +import org.apache.sshd.client.config.keys.ClientIdentityLoader; import org.apache.sshd.client.future.AuthFuture; import org.apache.sshd.client.keyverifier.ServerKeyVerifier; import org.apache.sshd.client.session.ClientSession; +import org.apache.sshd.common.config.keys.FilePasswordProvider; import org.apache.sshd.common.util.SecurityUtils; import org.junit.After; import org.junit.AfterClass; @@ -98,6 +102,16 @@ public abstract class SshUnitTest extends GitblitUnitTest { protected SshClient getClient() { SshClient client = SshClient.setUpDefaultClient(); + client.setClientIdentityLoader(new ClientIdentityLoader() { // Ignore the files under ~/.ssh + @Override + public boolean isValidLocation(String location) throws IOException { + return true; + } + @Override + public KeyPair loadClientIdentity(String location, FilePasswordProvider provider) throws IOException, GeneralSecurityException { + return null; + } + }); client.setServerKeyVerifier(new ServerKeyVerifier() { @Override public boolean verifyServerKey(ClientSession sshClientSession, SocketAddress remoteAddress, PublicKey serverKey) { @@ -135,7 +149,7 @@ public abstract class SshUnitTest extends GitblitUnitTest { channel.setErr(err); channel.open(); - channel.waitFor(EnumSet.of(ClientChannel.ClientChannelEvent.CLOSED), 0); + channel.waitFor(EnumSet.of(ClientChannelEvent.CLOSED, ClientChannelEvent.EOF), 0); String result = out.toString().trim(); channel.close(false); |