/** * Do key exchange. * * @throws TransportException if error during kex */ protected void doKex() throws TransportException { checkConnected(); final long start = System.currentTimeMillis(); trans.doKex(); log.debug("Key exchange took {} seconds", (System.currentTimeMillis() - start) / 1000.0); }
/** * Authenticate {@code username} using the supplied {@code methods}. * * @param username user to authenticate * @param methods one or more authentication method * * @throws UserAuthException in case of authentication failure * @throws TransportException if there was a transport-layer error */ public void auth(String username, AuthMethod... methods) throws UserAuthException, TransportException { checkConnected(); auth(username, Arrays.<AuthMethod>asList(methods)); }
/** @return Instantiated {@link SCPFileTransfer} implementation. */ public SCPFileTransfer newSCPFileTransfer() { checkConnected(); checkAuthenticated(); return new SCPFileTransfer(this, loggerFactory); }
@Override public Session startSession() throws ConnectionException, TransportException { checkConnected(); checkAuthenticated(); final SessionChannel sess = new SessionChannel(conn, remoteCharset); sess.open(); return sess; }
/** * Authenticate {@code username} using the supplied {@code methods}. * * @param username user to authenticate * @param methods one or more authentication method * * @throws UserAuthException in case of authentication failure * @throws TransportException if there was a transport-layer error */ public void auth(String username, Iterable<AuthMethod> methods) throws UserAuthException, TransportException { checkConnected(); final Deque<UserAuthException> savedEx = new LinkedList<UserAuthException>(); for (AuthMethod method: methods) { method.setLoggerFactory(loggerFactory); try { if (auth.authenticate(username, (Service) conn, method, trans.getTimeoutMs())) return; } catch (UserAuthException e) { savedEx.push(e); } } throw new UserAuthException("Exhausted available authentication methods", savedEx.peek()); }
/** * @return Instantiated {@link SFTPClient} implementation. * * @throws IOException if there is an error starting the {@code sftp} subsystem * @see StatefulSFTPClient */ public SFTPClient newSFTPClient() throws IOException { checkConnected(); checkAuthenticated(); return new SFTPClient(new SFTPEngine(this).init()); }
/** * Do key exchange. * * @throws TransportException if error during kex */ protected void doKex() throws TransportException { checkConnected(); final long start = System.currentTimeMillis(); trans.doKex(); log.debug("Key exchange took {} seconds", (System.currentTimeMillis() - start) / 1000.0); }
/** * Do key exchange. * * @throws TransportException if error during kex */ protected void doKex() throws TransportException { checkConnected(); final long start = System.currentTimeMillis(); trans.doKex(); log.debug("Key exchange took {} seconds", (System.currentTimeMillis() - start) / 1000.0); }
/** * Authenticate {@code username} using the supplied {@code methods}. * * @param username user to authenticate * @param methods one or more authentication method * * @throws UserAuthException in case of authentication failure * @throws TransportException if there was a transport-layer error */ public void auth(String username, AuthMethod... methods) throws UserAuthException, TransportException { checkConnected(); auth(username, Arrays.<AuthMethod>asList(methods)); }
/** * Authenticate {@code username} using the supplied {@code methods}. * * @param username user to authenticate * @param methods one or more authentication method * * @throws UserAuthException in case of authentication failure * @throws TransportException if there was a transport-layer error */ public void auth(String username, AuthMethod... methods) throws UserAuthException, TransportException { checkConnected(); auth(username, Arrays.<AuthMethod>asList(methods)); }
/** @return Instantiated {@link SCPFileTransfer} implementation. */ public SCPFileTransfer newSCPFileTransfer() { checkConnected(); checkAuthenticated(); return new SCPFileTransfer(this, loggerFactory); }
/** @return Instantiated {@link SCPFileTransfer} implementation. */ public SCPFileTransfer newSCPFileTransfer() { checkConnected(); checkAuthenticated(); return new SCPFileTransfer(this); }
/** * Authenticate {@code username} using the supplied {@code methods}. * * @param username user to authenticate * @param methods one or more authentication method * * @throws UserAuthException in case of authentication failure * @throws TransportException if there was a transport-layer error */ public void auth(String username, Iterable<AuthMethod> methods) throws UserAuthException, TransportException { checkConnected(); final Deque<UserAuthException> savedEx = new LinkedList<UserAuthException>(); for (AuthMethod method: methods) { try { if (auth.authenticate(username, (Service) conn, method, trans.getTimeoutMs())) return; } catch (UserAuthException e) { savedEx.push(e); } } throw new UserAuthException("Exhausted available authentication methods", savedEx.peek()); }
@Override public Session startSession() throws ConnectionException, TransportException { checkConnected(); checkAuthenticated(); final SessionChannel sess = new SessionChannel(conn, remoteCharset); sess.open(); return sess; }
@Override public Session startSession() throws ConnectionException, TransportException { checkConnected(); checkAuthenticated(); final SessionChannel sess = new SessionChannel(conn); sess.open(); return sess; }
/** * Authenticate {@code username} using the supplied {@code methods}. * * @param username user to authenticate * @param methods one or more authentication method * * @throws UserAuthException in case of authentication failure * @throws TransportException if there was a transport-layer error */ public void auth(String username, Iterable<AuthMethod> methods) throws UserAuthException, TransportException { checkConnected(); final Deque<UserAuthException> savedEx = new LinkedList<UserAuthException>(); for (AuthMethod method: methods) { method.setLoggerFactory(loggerFactory); try { if (auth.authenticate(username, (Service) conn, method, trans.getTimeoutMs())) return; } catch (UserAuthException e) { savedEx.push(e); } } throw new UserAuthException("Exhausted available authentication methods", savedEx.peek()); }
/** * @return Instantiated {@link SFTPClient} implementation. * * @throws IOException if there is an error starting the {@code sftp} subsystem * @see StatefulSFTPClient */ public SFTPClient newSFTPClient() throws IOException { checkConnected(); checkAuthenticated(); return new SFTPClient(new SFTPEngine(this).init()); }
/** * @return Instantiated {@link SFTPClient} implementation. * * @throws IOException if there is an error starting the {@code sftp} subsystem * @see StatefulSFTPClient */ public SFTPClient newSFTPClient() throws IOException { checkConnected(); checkAuthenticated(); return new SFTPClient(new SFTPEngine(this).init()); }