/** * Create with an associated {@link Transport}. * * @param trans transport layer * @param keepAlive the keep alive provider */ public ConnectionImpl(Transport trans, KeepAliveProvider keepAlive) { super("ssh-connection", trans); timeoutMs = trans.getTimeoutMs(); this.keepAlive = keepAlive.provide(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) { 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()); }
/** * Create with an associated {@link Transport}. * * @param trans transport layer */ public ConnectionImpl(Transport trans) { super("ssh-connection", trans); timeoutMs = trans.getTimeoutMs(); }
/** * Create with an associated {@link Transport}. * * @param trans transport layer * @param keepAlive the keep alive provider */ public ConnectionImpl(Transport trans, KeepAliveProvider keepAlive) { super("ssh-connection", trans); timeoutMs = trans.getTimeoutMs(); this.keepAlive = keepAlive.provide(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()); }
/** * 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()); }