Examples of SftpFileSystemConfigBuilder


Examples of org.apache.commons.vfs2.provider.sftp.SftpFileSystemConfigBuilder

  @Override
  public final void authSetup(final ConnectionDescription description, final FileSystemOptions options) throws org.apache.commons.vfs2.FileSystemException {
    StaticUserAuthenticator auth = new StaticUserAuthenticator(null, description.getParameter(ConnectionDescription.PARAMETER_USERNAME), description.getSecretParameter(ConnectionDescription.PARAMETER_PASSWORD));
    DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(options, auth);
    SftpFileSystemConfigBuilder cfg = SftpFileSystemConfigBuilder.getInstance();
    if (null != sshDirName) {
      cfg.setKnownHosts(options, new File(sshDirName, "known_hosts"));
    }
    logger.debug("SFTP using knownHosts: ", cfg.getKnownHosts(options));
    cfg.setUserInfo(options, this);
    cfg.setStrictHostKeyChecking(options, "ask");
    if ("enabled".equals(description.getParameter("publicKeyAuth"))) {
      cfg.setPreferredAuthentications(options, "publickey,password,keyboard-interactive");
    }
    else {
      cfg.setPreferredAuthentications(options, "password,keyboard-interactive");
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.