Skip to content

Commit

Permalink
Merge pull request #13700 from iterate-ch/bugfix/GH-13442-auth-order
Browse files Browse the repository at this point in the history
Prioritise password authentication if one is set.
  • Loading branch information
dkocher committed Aug 31, 2022
2 parents 55e8661 + e7ad2b4 commit 59e1090
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ssh/src/main/java/ch/cyberduck/core/sftp/SFTPSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,12 @@ private void authenticate(final SSHClient client, final Host host, final LoginCa
}
defaultMethods.add(new SFTPPublicKeyAuthentication(client));
defaultMethods.add(new SFTPChallengeResponseAuthentication(client));
defaultMethods.add(new SFTPPasswordAuthentication(client));
if(credentials.isPasswordAuthentication()) {
defaultMethods.add(0, new SFTPPasswordAuthentication(client));
}
else {
defaultMethods.add(new SFTPPasswordAuthentication(client));
}
final LinkedHashMap<String, List<AuthenticationProvider<Boolean>>> methodsMap = new LinkedHashMap<>();
defaultMethods.forEach(m -> methodsMap.computeIfAbsent(m.getMethod(), k -> new ArrayList<>()).add(m));
final List<AuthenticationProvider<Boolean>> methods = new ArrayList<>();
Expand Down

0 comments on commit 59e1090

Please sign in to comment.