@Test(expected = LoginFailureException.class) public void testLoginFailure() throws Exception { final Host host = new Host(new SwiftProtocol(), "identity.api.rackspacecloud.com", new Credentials( "a", "s" )); assertNotNull(session.open(Proxy.DIRECT, new DisabledHostKeyCallback(), new DisabledLoginCallback())); assertTrue(session.isConnected()); assertNotNull(session.getClient()); session.login(Proxy.DIRECT, new DisabledLoginCallback(), new DisabledCancelCallback()); }
@Override public void login(final Proxy proxy, final LoginCallback prompt, final CancelCallback cancel) throws BackgroundException { try { final Set<? extends AuthenticationRequest> options = new SwiftAuthenticationService().getRequest(host, prompt); for(Iterator<? extends AuthenticationRequest> iter = options.iterator(); iter.hasNext(); ) { try { final AuthenticationRequest auth = iter.next(); if(log.isInfoEnabled()) { log.info(String.format("Attempt authentication with %s", auth)); } client.authenticate(auth); break; } catch(GenericException failure) { final BackgroundException reason = new SwiftExceptionMappingService().map(failure); if(reason instanceof LoginFailureException || reason instanceof AccessDeniedException || reason instanceof InteroperabilityException) { if(!iter.hasNext()) { throw failure; } } else { throw failure; } } cancel.verify(); } } catch(GenericException e) { throw new SwiftExceptionMappingService().map(e); } catch(IOException e) { throw new DefaultIOExceptionMappingService().map(e); } }
SwiftSession extends HttpSession<Client> { @Override public void login(final Proxy proxy, final LoginCallback prompt, final CancelCallback cancel) throws BackgroundException { try { final Set<? extends AuthenticationRequest> options = new SwiftAuthenticationService().getRequest(host, prompt); for(Iterator<? extends AuthenticationRequest> iter = options.iterator(); iter.hasNext(); ) { try { final AuthenticationRequest auth = iter.next(); if(log.isInfoEnabled()) { log.info(String.format("Attempt authentication with %s", auth)); } client.authenticate(auth); break; } catch(GenericException failure) { final BackgroundException reason = new SwiftExceptionMappingService().map(failure); if(reason instanceof LoginFailureException || reason instanceof AccessDeniedException || reason instanceof InteroperabilityException) { if(!iter.hasNext()) { throw failure; } } else { throw failure; } } cancel.verify(); } } catch(GenericException e) { throw new SwiftExceptionMappingService().map(e); } catch(IOException e) { throw new DefaultIOExceptionMappingService().map(e); } } }
SwiftSession extends HttpSession<Client> { @Override public void login(final Proxy proxy, final LoginCallback prompt, final CancelCallback cancel) throws BackgroundException { try { final Set<? extends AuthenticationRequest> options = new SwiftAuthenticationService().getRequest(host, prompt); for(Iterator<? extends AuthenticationRequest> iter = options.iterator(); iter.hasNext(); ) { try { final AuthenticationRequest auth = iter.next(); if(log.isInfoEnabled()) { log.info(String.format("Attempt authentication with %s", auth)); } client.authenticate(auth); break; } catch(GenericException failure) { final BackgroundException reason = new SwiftExceptionMappingService().map(failure); if(reason instanceof LoginFailureException || reason instanceof AccessDeniedException || reason instanceof InteroperabilityException) { if(!iter.hasNext()) { throw failure; } } else { throw failure; } } cancel.verify(); } } catch(GenericException e) { throw new SwiftExceptionMappingService().map(e); } catch(IOException e) { throw new DefaultIOExceptionMappingService().map(e); } } SwiftSession(final Host host, final X509TrustManager trust, final X509KeyManager key); }
SwiftSession extends HttpSession<Client> { @Override public void login(final Proxy proxy, final LoginCallback prompt, final CancelCallback cancel) throws BackgroundException { try { final Set<? extends AuthenticationRequest> options = new SwiftAuthenticationService().getRequest(host, prompt); for(Iterator<? extends AuthenticationRequest> iter = options.iterator(); iter.hasNext(); ) { try { final AuthenticationRequest auth = iter.next(); if(log.isInfoEnabled()) { log.info(String.format("Attempt authentication with %s", auth)); } client.authenticate(auth); break; } catch(GenericException failure) { final BackgroundException reason = new SwiftExceptionMappingService().map(failure); if(reason instanceof LoginFailureException || reason instanceof AccessDeniedException || reason instanceof InteroperabilityException) { if(!iter.hasNext()) { throw failure; } } else { throw failure; } } cancel.verify(); } } catch(GenericException e) { throw new SwiftExceptionMappingService().map(e); } catch(IOException e) { throw new DefaultIOExceptionMappingService().map(e); } } SwiftSession(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 @SuppressWarnings("unchecked") T _getFeature(final Class<T> type); }
SwiftSession extends HttpSession<Client> { @Override public void login(final Proxy proxy, final LoginCallback prompt, final CancelCallback cancel) throws BackgroundException { try { final Set<? extends AuthenticationRequest> options = new SwiftAuthenticationService().getRequest(host, prompt); for(Iterator<? extends AuthenticationRequest> iter = options.iterator(); iter.hasNext(); ) { try { final AuthenticationRequest auth = iter.next(); if(log.isInfoEnabled()) { log.info(String.format("Attempt authentication with %s", auth)); } client.authenticate(auth); break; } catch(GenericException failure) { final BackgroundException reason = new SwiftExceptionMappingService().map(failure); if(reason instanceof LoginFailureException || reason instanceof AccessDeniedException || reason instanceof InteroperabilityException) { if(!iter.hasNext()) { throw failure; } } else { throw failure; } } cancel.verify(); } } catch(GenericException e) { throw new SwiftExceptionMappingService().map(e); } catch(IOException e) { throw new DefaultIOExceptionMappingService().map(e); } } SwiftSession(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 @SuppressWarnings("unchecked") T _getFeature(final Class<T> type);  }