@Test(expected = LoginCanceledException.class) public void testConnectInvalidAccessToken() throws Exception { final ProtocolFactory factory = new ProtocolFactory(new HashSet<>(Collections.singleton(new HubicProtocol()))); final Profile profile = new ProfilePlistReader(factory).read( new Local("../profiles/hubiC.cyberduckprofile")); final HubicSession session = new HubicSession(new Host(profile, new HubicProtocol().getDefaultHostname(), new Credentials("u@domain")), new DisabledX509TrustManager(), new DefaultX509KeyManager()); session.open(Proxy.DIRECT, new DisabledHostKeyCallback(), new DisabledLoginCallback()); session.login(Proxy.DIRECT, new DisabledLoginCallback(), new DisabledCancelCallback()); session.close(); }
@Override public void login(final Proxy proxy, final LoginCallback prompt, final CancelCallback cancel) throws BackgroundException { final OAuthTokens tokens = authorizationService.authorize(host, prompt, cancel); try { if(log.isInfoEnabled()) { log.info(String.format("Attempt authentication with %s", tokens)); } client.authenticate(new HubicAuthenticationRequest(tokens.getAccessToken()), new HubicAuthenticationResponseHandler()); } catch(GenericException e) { throw new SwiftExceptionMappingService().map(e); } catch(IOException e) { throw new DefaultIOExceptionMappingService().map(e); } }
HubicSession extends SwiftSession { @Override public void login(final Proxy proxy, final LoginCallback prompt, final CancelCallback cancel) throws BackgroundException { final OAuthTokens tokens = authorizationService.authorize(host, prompt, cancel); try { if(log.isInfoEnabled()) { log.info(String.format("Attempt authentication with %s", tokens)); } client.authenticate(new HubicAuthenticationRequest(tokens.getAccessToken()), new HubicAuthenticationResponseHandler()); } catch(GenericException e) { throw new SwiftExceptionMappingService().map(e); } catch(IOException e) { throw new DefaultIOExceptionMappingService().map(e); } } }
HubicSession extends SwiftSession { @Override public void login(final Proxy proxy, final LoginCallback prompt, final CancelCallback cancel) throws BackgroundException { final OAuthTokens tokens = authorizationService.authorize(host, prompt, cancel); try { if(log.isInfoEnabled()) { log.info(String.format("Attempt authentication with %s", tokens)); } client.authenticate(new HubicAuthenticationRequest(tokens.getAccessToken()), new HubicAuthenticationResponseHandler()); } catch(GenericException e) { throw new SwiftExceptionMappingService().map(e); } catch(IOException e) { throw new DefaultIOExceptionMappingService().map(e); } } HubicSession(final Host host, final X509TrustManager trust, final X509KeyManager key); }
HubicSession extends SwiftSession { @Override public void login(final Proxy proxy, final LoginCallback prompt, final CancelCallback cancel) throws BackgroundException { final OAuthTokens tokens = authorizationService.authorize(host, prompt, cancel); try { if(log.isInfoEnabled()) { log.info(String.format("Attempt authentication with %s", tokens)); } client.authenticate(new HubicAuthenticationRequest(tokens.getAccessToken()), new HubicAuthenticationResponseHandler()); } catch(GenericException e) { throw new SwiftExceptionMappingService().map(e); } catch(IOException e) { throw new DefaultIOExceptionMappingService().map(e); } } HubicSession(final Host host, final X509TrustManager trust, final X509KeyManager key); @Override Client connect(final Proxy proxy, final HostKeyCallback key, final LoginCallback prompt); @Override void login(final Proxy proxy, final LoginCallback prompt, final CancelCallback cancel); @Override T _getFeature(final Class<T> type); }
HubicSession extends SwiftSession { @Override public void login(final Proxy proxy, final LoginCallback prompt, final CancelCallback cancel) throws BackgroundException { final OAuthTokens tokens = authorizationService.authorize(host, prompt, cancel); try { if(log.isInfoEnabled()) { log.info(String.format("Attempt authentication with %s", tokens)); } client.authenticate(new HubicAuthenticationRequest(tokens.getAccessToken()), new HubicAuthenticationResponseHandler()); } catch(GenericException e) { throw new SwiftExceptionMappingService().map(e); } catch(IOException e) { throw new DefaultIOExceptionMappingService().map(e); } } HubicSession(final Host host, final X509TrustManager trust, final X509KeyManager key); @Override Client connect(final Proxy proxy, final HostKeyCallback key, final LoginCallback prompt); @Override void login(final Proxy proxy, final LoginCallback prompt, final CancelCallback cancel); @Override T _getFeature(final Class<T> type);  }