@Test(expected = UnregisteredUserAuthException.class) public void testUnregisteredUserAuthException() throws RemoteApiException { proxy.authenticate("test"); }
@Override public void authenticate(String userId) throws AuthenticationException { UserAuthenticationContext context = contextForUser(userId); if (!context.isAuthenticated()) { LOG.info("Authenticate {}", userId); try { Token sessionToken = sbeAuthApi.authenticate(userId); Token keyManagerToken = keyManagerAuthApi.authenticate(userId); context.setToken( new AuthenticationToken(sessionToken.getToken(), keyManagerToken.getToken())); } catch (RemoteApiException e) { checkAndThrowException(e, userId); } catch (ConnectivityException e) { throw e; } catch (Exception e) { throw new UnexpectedAuthException( logMessage.getMessage(UNEXPECTED_SESSION_TOKEN_MESSAGE, userId), e, logMessage.getMessage(UNEXPECTED_SESSION_TOKEN_SOLUTION)); } } }
AuthenticationProxyImpl implements AuthenticationProxy { @Override public void authenticate(String userId) throws AuthenticationException { UserAuthenticationContext context = contextForUser(userId); if (!context.isAuthenticated()) { LOG.info("Authenticate {}", userId); try { Token sessionToken = sbeAuthApi.authenticate(userId); Token keyManagerToken = keyManagerAuthApi.authenticate(userId); context.setToken( new AuthenticationToken(sessionToken.getToken(), keyManagerToken.getToken())); } catch (RemoteApiException e) { checkAndThrowException(e, userId); } catch (ConnectivityException e) { throw e; } catch (Exception e) { throw new UnexpectedAuthException( logMessage.getMessage(UNEXPECTED_SESSION_TOKEN_MESSAGE, userId), e, logMessage.getMessage(UNEXPECTED_SESSION_TOKEN_SOLUTION)); } } } }
AuthenticationProxyImpl implements AuthenticationProxy { @Override public void authenticate(String userId) throws AuthenticationException { UserAuthenticationContext context = contextForUser(userId); if (!context.isAuthenticated()) { LOG.info("Authenticate {}", userId); try { Token sessionToken = sbeAuthApi.authenticate(userId); Token keyManagerToken = keyManagerAuthApi.authenticate(userId); context.setToken( new AuthenticationToken(sessionToken.getToken(), keyManagerToken.getToken())); } catch (RemoteApiException e) { checkAndThrowException(e, userId); } catch (ConnectivityException e) { throw e; } catch (Exception e) { throw new UnexpectedAuthException( logMessage.getMessage(UNEXPECTED_SESSION_TOKEN_MESSAGE, userId), e, logMessage.getMessage(UNEXPECTED_SESSION_TOKEN_SOLUTION)); } } }  }
AuthenticationProxyImpl implements AuthenticationProxy { @Override public void authenticate(String userId) throws AuthenticationException { UserAuthenticationContext context = contextForUser(userId); if (!context.isAuthenticated()) { LOG.info("Authenticate {}", userId); try { Token sessionToken = sbeAuthApi.authenticate(userId); Token keyManagerToken = keyManagerAuthApi.authenticate(userId); context.setToken( new AuthenticationToken(sessionToken.getToken(), keyManagerToken.getToken())); } catch (RemoteApiException e) { checkAndThrowException(e, userId); } catch (ConnectivityException e) { throw e; } catch (Exception e) { throw new UnexpectedAuthException( logMessage.getMessage(UNEXPECTED_SESSION_TOKEN_MESSAGE, userId), e, logMessage.getMessage(UNEXPECTED_SESSION_TOKEN_SOLUTION)); } } }  @PostConstruct void init(); @Override void authenticate(String userId); @Override boolean isAuthenticated(String user); @Override void invalidate(String userId); @Override AuthenticationToken getToken(String configurationId); @Override String getSessionToken(String configurationId); @Override synchronized void reAuthOrThrow(String userId, RemoteApiException remoteApiException); @Override synchronized AuthenticationToken reAuthSessionOrThrow(String sessionToken, RemoteApiException remoteApiException); @Override boolean sessionNoLongerEntitled(int code); @Override boolean sessionUnauthorized(int code); @Override void registerUser(String userId, KeyStore keyStore, String keyStorePass); @Override Client httpClientForUser(String userId, ServiceName serviceName); @Override Client httpClientForSessionToken(String sessionToken, ServiceName serviceName); }
AuthenticationProxyImpl implements AuthenticationProxy { @Override public void authenticate(String userId) throws AuthenticationException { UserAuthenticationContext context = contextForUser(userId); if (!context.isAuthenticated()) { LOG.info("Authenticate {}", userId); try { Token sessionToken = sbeAuthApi.authenticate(userId); Token keyManagerToken = keyManagerAuthApi.authenticate(userId); context.setToken( new AuthenticationToken(sessionToken.getToken(), keyManagerToken.getToken())); } catch (RemoteApiException e) { checkAndThrowException(e, userId); } catch (ConnectivityException e) { throw e; } catch (Exception e) { throw new UnexpectedAuthException( logMessage.getMessage(UNEXPECTED_SESSION_TOKEN_MESSAGE, userId), e, logMessage.getMessage(UNEXPECTED_SESSION_TOKEN_SOLUTION)); } } }  @PostConstruct void init(); @Override void authenticate(String userId); @Override boolean isAuthenticated(String user); @Override void invalidate(String userId); @Override AuthenticationToken getToken(String configurationId); @Override String getSessionToken(String configurationId); @Override synchronized void reAuthOrThrow(String userId, RemoteApiException remoteApiException); @Override synchronized AuthenticationToken reAuthSessionOrThrow(String sessionToken, RemoteApiException remoteApiException); @Override boolean sessionNoLongerEntitled(int code); @Override boolean sessionUnauthorized(int code); @Override void registerUser(String userId, KeyStore keyStore, String keyStorePass); @Override Client httpClientForUser(String userId, ServiceName serviceName); @Override Client httpClientForSessionToken(String sessionToken, ServiceName serviceName);  }