private String getScpDir(String path) { return String.format("%s:%s@%s:%s", userInfo.getName(), userInfo.getKeyfile() == null ? userInfo.getPassword() : userInfo.getPassphrase(), scp.getHost(), path); }
throw new BuildException( "neither password nor keyfile for user %s has been given. Can't authenticate.", getUserInfo().getName());
throw new BuildException("Host is required."); if (userInfo.getName() == null) { throw new BuildException("Username is required.");
private void validateArguments() { if (getHost() == null) { throw new BuildException("Host is required."); } if (getUserInfo().getName() == null) { throw new BuildException("Username is required."); } if (getUserInfo().getKeyfile() == null && getUserInfo().getPassword() == null) { throw new BuildException("Password or Keyfile is required."); } if (getRhost() == null || getLport() == null || getRport() == null) { throw new BuildException("Tunnel information is required. \n Either rhost, lport or rport is not set."); } }
/** * Open an ssh session. * * @return the opened session * @throws JSchException * on error */ protected Session openSession() throws JSchException { JSch jsch = new JSch(); if (null != userInfo.getKeyfile()) { jsch.addIdentity(userInfo.getKeyfile()); } if (!userInfo.getTrust() && knownHosts != null) { project.log("Using known hosts: " + knownHosts, Project.MSG_DEBUG); jsch.setKnownHosts(knownHosts); } Session session = jsch.getSession(userInfo.getName(), host, port); session.setUserInfo(userInfo); project.log("Connecting to " + host + ":" + port, Project.MSG_VERBOSE); session.connect(); return session; }
throw new BuildException("Host is required."); if (getUserInfo().getName() == null) { throw new BuildException("Username is required.");
throw new BuildException("Host is required."); if (getUserInfo().getName() == null) { throw new BuildException("Username is required.");
final Session session = jsch.getSession(userInfo.getName(), host, port); session.setConfig("PreferredAuthentications", "publickey,keyboard-interactive,password");
throw new BuildException("Host is required."); if (getUserInfo().getName() == null) { throw new BuildException("Username is required.");
Session session = jsch.getSession(base.getUserInfo().getName(), base.getHost(), base.getPort()); long conTimeout = base.getConnectTimeout(); if(conTimeout<1){