@Override public boolean authenticate(String username, Service nextService, AuthMethod method, int timeoutMs) throws UserAuthException, TransportException { final boolean outcome; authenticated.lock(); try { super.request(); // Request "ssh-userauth" service (if not already active) currentMethod = method; this.nextService = nextService; currentMethod.init(makeAuthParams(username, nextService)); authenticated.clear(); log.debug("Trying `{}` auth...", method.getName()); currentMethod.request(); outcome = authenticated.retrieve(timeoutMs, TimeUnit.MILLISECONDS); if (outcome) { log.debug("`{}` auth successful", method.getName()); } else { log.debug("`{}` auth failed", method.getName()); } } finally { // Clear the internal state. currentMethod = null; this.nextService = null; authenticated.unlock(); } return outcome; }
@Override public boolean authenticate(String username, Service nextService, AuthMethod method, int timeoutMs) throws UserAuthException, TransportException { final boolean outcome; authenticated.lock(); try { super.request(); // Request "ssh-userauth" service (if not already active) currentMethod = method; this.nextService = nextService; currentMethod.init(makeAuthParams(username, nextService)); authenticated.clear(); log.debug("Trying `{}` auth...", method.getName()); currentMethod.request(); outcome = authenticated.retrieve(timeoutMs, TimeUnit.MILLISECONDS); if (outcome) { log.debug("`{}` auth successful", method.getName()); } else { log.debug("`{}` auth failed", method.getName()); } } finally { // Clear the internal state. currentMethod = null; this.nextService = null; authenticated.unlock(); } return outcome; }
@Override public boolean authenticate(String username, Service nextService, AuthMethod method, int timeoutMs) throws UserAuthException, TransportException { final boolean outcome; authenticated.lock(); try { super.request(); // Request "ssh-userauth" service (if not already active) currentMethod = method; currentMethod.init(makeAuthParams(username, nextService)); authenticated.clear(); log.debug("Trying `{}` auth...", method.getName()); currentMethod.request(); outcome = authenticated.retrieve(timeoutMs, TimeUnit.MILLISECONDS); if (outcome) { log.debug("`{}` auth successful", method.getName()); trans.setAuthenticated(); // So it can put delayed compression into force if applicable trans.setService(nextService); // We aren't in charge anymore, next service is } else { log.debug("`{}` auth failed", method.getName()); } } finally { currentMethod = null; authenticated.unlock(); } return outcome; }