Cyberduck Mountain Duck CLI

Changeset 43555


Ignore:
Timestamp:
Dec 12, 2017 1:18:12 PM (6 months ago)
Author:
dkocher
Message:

Read keychain setting from credential input prompt. Fix #10159.

Location:
shelves/12.2017
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • shelves/12.2017

    • Property subgit:lock changed from commit:2916f17d2a38351defdbd7480382413ad6d0ca41 timestamp:2017-12-12T13:18:35.605 to commit:76b4ea9b08f66b0255fa13474a603dec724df717 timestamp:2017-12-12T13:18:37.375
  • shelves/12.2017/ssh/src/main/java/ch/cyberduck/core/sftp/auth/SFTPChallengeResponseAuthentication.java

    r43477 r43555  
    6161        final AtomicBoolean canceled = new AtomicBoolean();
    6262        try {
    63             session.getClient().auth(bookmark.getCredentials().getUsername(), new AuthKeyboardInteractive(new ChallengeResponseProvider() {
     63            final Credentials credentials = bookmark.getCredentials();
     64            session.getClient().auth(credentials.getUsername(), new AuthKeyboardInteractive(new ChallengeResponseProvider() {
    6465                private String name = StringUtils.EMPTY;
    6566                private String instruction = StringUtils.EMPTY;
     
    8586                        log.debug(String.format("Reply to challenge name %s with instruction %s", name, instruction));
    8687                    }
    87                     if(!StringUtils.isBlank(bookmark.getCredentials().getPassword())
    88                         && PasswordResponseProvider.DEFAULT_PROMPT_PATTERN.matcher(prompt).matches()) {
    89                         if(StringUtils.isBlank(bookmark.getCredentials().getPassword())) {
     88                    if(PasswordResponseProvider.DEFAULT_PROMPT_PATTERN.matcher(prompt).matches()) {
     89                        if(StringUtils.isBlank(credentials.getPassword())) {
    9090                            try {
    91                                 bookmark.getCredentials().setPassword(callback.prompt(bookmark, bookmark.getCredentials().getUsername(),
     91                                final Credentials input = callback.prompt(bookmark, credentials.getUsername(),
    9292                                    String.format("%s %s", LocaleFactory.localizedString("Login", "Login"), bookmark.getHostname()),
    9393                                    MessageFormat.format(LocaleFactory.localizedString(
    9494                                        "Login {0} with username and password", "Credentials"), BookmarkNameProvider.toString(bookmark)),
    9595                                    new LoginOptions(bookmark.getProtocol()).publickey(false)
    96                                         .usernamePlaceholder(bookmark.getCredentials().getUsername())).getPassword());
     96                                        .usernamePlaceholder(credentials.getUsername()));
     97                                credentials.setSaved(input.isSaved());
     98                                credentials.setPassword(input.getPassword());
    9799                            }
    98100                            catch(LoginCanceledException e) {
     
    102104                            }
    103105                        }
    104                         return bookmark.getCredentials().getPassword().toCharArray();
     106                        return credentials.getPassword().toCharArray();
    105107                    }
    106108                    else {
     
    113115                                LocaleFactory.localizedString("Provide additional login credentials", "Credentials")
    114116                            );
    115                             additional = callback.prompt(bookmark, bookmark.getCredentials().getUsername(), title.toString(),
    116                                 message.toString(), new LoginOptions(bookmark.getProtocol()).user(false).publickey(false).keychain(PasswordResponseProvider.DEFAULT_PROMPT_PATTERN.matcher(prompt).matches())
    117                                     .usernamePlaceholder(bookmark.getCredentials().getUsername())
     117                            additional = callback.prompt(bookmark, credentials.getUsername(), title.toString(),
     118                                message.toString(), new LoginOptions(bookmark.getProtocol()).user(false).publickey(false).keychain(false)
     119                                    .usernamePlaceholder(credentials.getUsername())
    118120                            );
    119121                        }
Note: See TracChangeset for help on using the changeset viewer.
swiss made software