This is an automated email from the ASF dual-hosted git repository. tomaswolf pushed a commit to branch rc-2.20.0 in repository https://gitbox.apache.org/repos/asf/mina-sshd.git
commit 5d089237bcc9b6f7a1ca27d6a40dd49dd1df6f1d Author: Thomas Wolf <[email protected]> AuthorDate: Wed Sep 23 23:54:21 2026 +0200 Add a test for multi-authentication Test "publickey,publickey publickey,password" with only one key and one password in the client. --- .../sshd/client/auth/pubkey/MultiAuthTest.java | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/sshd-core/src/test/java/org/apache/sshd/client/auth/pubkey/MultiAuthTest.java b/sshd-core/src/test/java/org/apache/sshd/client/auth/pubkey/MultiAuthTest.java index dea0b3e84..be6080bb8 100644 --- a/sshd-core/src/test/java/org/apache/sshd/client/auth/pubkey/MultiAuthTest.java +++ b/sshd-core/src/test/java/org/apache/sshd/client/auth/pubkey/MultiAuthTest.java @@ -258,6 +258,30 @@ class MultiAuthTest extends BaseTestSupport { assertEquals(expected, sb.toString()); } + @Test + void testConnect6() throws Exception { + CoreModuleProperties.AUTH_METHODS.set(sshd, "publickey,publickey publickey,password"); + StringBuilder sb = new StringBuilder(); + try (ClientSession session = createClientSession(USER_NAME, client, port)) { + session.setKeyIdentityProvider(ctx -> { + List<KeyPair> result = new ArrayList<>(); + result.add(rsaKeyUser); + return result; + }); + session.setPasswordIdentityProvider(PasswordIdentityProvider.wrapPasswords(PASSWORD)); + session.setPublicKeyAuthenticationReporter(new PubkeyReporter(sb)); + session.setPasswordAuthenticationReporter(new PasswordReporter(sb)); + session.auth().verify(AUTH_TIMEOUT); + } catch (Exception e) { + throw new RuntimeException(e.getMessage() + '\n' + sb.toString(), e); + } + String expected = "publickey TRY RSA rsa-sha2-512\n" // + + "publickey PARTIAL RSA\n" // + + "password TRY pass\n" // + + "password SUCCESS pass\n"; + assertEquals(expected, sb.toString()); + } + private static class PubkeyReporter implements PublicKeyAuthenticationReporter { private final StringBuilder out;
