@Override public void chunk(final Path parent, final AttributedList<Path> list) throws ListCanceledException { try { cancel.verify(); } catch(ConnectionCanceledException e) { throw new ListCanceledException(list, e); } } });
public void register(final OAuth2TokenListener listener, final CancelCallback cancel) throws ConnectionCanceledException { listeners.add(listener); synchronized(global) { try { while(listeners.contains(listener)) { // Not yet notified cancel.verify(); global.wait(500L); } } catch(InterruptedException e) { throw new OAuthInterruptedException(); } } }
cancel.verify();
log.debug(String.format("Attempt authentication with credentials %s and authentication method %s", credentials, auth)); cancel.verify(); try { if(!auth.authenticate(host, prompt, cancel)) {
@Override public Boolean authenticate(final Host bookmark, final LoginCallback prompt, final CancelCallback cancel) throws BackgroundException { if(log.isDebugEnabled()) { log.debug(String.format("Login using agent %s for %s", agent, bookmark)); } for(Identity identity : agent.getIdentities()) { try { session.getClient().auth(bookmark.getCredentials().getUsername(), new AuthAgent(agent.getProxy(), identity)); // Successfully authenticated break; } catch(UserAuthException e) { cancel.verify(); // Continue; } catch(Buffer.BufferException e) { throw new DefaultIOExceptionMappingService().map(e); } catch(TransportException e) { throw new SFTPExceptionMappingService().map(e); } } return session.getClient().isAuthenticated(); }
log.warn(String.format("Failed HEAD request to %s with %s. Retry with PROPFIND.", host, e.getResponsePhrase())); cancel.verify(); log.warn(String.format("Disable preemptive authentication for %s due to failure %s", host, e.getResponsePhrase())); cancel.verify(); client.disablePreemptiveAuthentication(); client.execute(new HttpHead(new DAVPathEncoder().encode(home)), new VoidResponseHandler());