@Test public void shouldThrow400ExceptionWithOrgDNNotValidReturningEmptyString() throws SSOException, AuthException, AuthLoginException, IOException { LoginConfiguration loginConfiguration = new LoginConfiguration(); HttpServletRequest request = mock(HttpServletRequest.class); String sessionId = "SESSION_ID"; AuthIndexType authIndexType = AuthIndexType.COMPOSITE; String authIndexValue = "INDEX_VALUE"; String ssoTokenId = "SSO_TOKEN_ID"; loginConfiguration.httpRequest(request) .sessionId(sessionId) .indexType(authIndexType) .indexValue(authIndexValue) .sessionUpgrade(ssoTokenId); given(coreServicesWrapper.getDomainNameByRequest(request)).willReturn(""); boolean exceptionCaught = false; RestAuthException exception = null; try { loginAuthenticator.getLoginProcess(loginConfiguration); } catch (RestAuthException e) { exceptionCaught = true; exception = e; } assertTrue(exceptionCaught); Response response = exception.getResponse(); assertEquals(response.getStatus(), 400); ObjectMapper objectMapper = new ObjectMapper(); JsonValue jsonValue = new JsonValue(objectMapper.readValue((String) response.getEntity(), Map.class)); assertEquals(jsonValue.size(), 1); assertTrue(jsonValue.isDefined("errorMessage")); }
public LoginProcess getLoginProcess(LoginConfiguration loginConfiguration) throws AuthException, AuthLoginException, SSOException { verifyAuthenticationRealm(loginConfiguration.getHttpRequest()); AuthContextLocalWrapper authContext = getAuthContext(loginConfiguration); LoginProcess loginProcess = new LoginProcess(this, loginConfiguration, authContext, coreServicesWrapper); if (coreServicesWrapper.isNewRequest(authContext)) { startLoginProcess(loginProcess); } return loginProcess; }
LoginAuthenticator { public LoginProcess getLoginProcess(LoginConfiguration loginConfiguration) throws AuthException, AuthLoginException, SSOException { verifyAuthenticationRealm(loginConfiguration.getHttpRequest()); AuthContextLocalWrapper authContext = getAuthContext(loginConfiguration); LoginProcess loginProcess = new LoginProcess(this, loginConfiguration, authContext, coreServicesWrapper); if (coreServicesWrapper.isNewRequest(authContext)) { startLoginProcess(loginProcess); } return loginProcess; } }
LoginAuthenticator { public LoginProcess getLoginProcess(LoginConfiguration loginConfiguration) throws AuthException, AuthLoginException, SSOException { verifyAuthenticationRealm(loginConfiguration.getHttpRequest()); AuthContextLocalWrapper authContext = getAuthContext(loginConfiguration); LoginProcess loginProcess = new LoginProcess(this, loginConfiguration, authContext, coreServicesWrapper); if (coreServicesWrapper.isNewRequest(authContext)) { startLoginProcess(loginProcess); } return loginProcess; } @Inject  LoginAuthenticator(CoreServicesWrapper coreServicesWrapper); }
LoginAuthenticator { public LoginProcess getLoginProcess(LoginConfiguration loginConfiguration) throws AuthException, AuthLoginException, SSOException { verifyAuthenticationRealm(loginConfiguration.getHttpRequest()); AuthContextLocalWrapper authContext = getAuthContext(loginConfiguration); LoginProcess loginProcess = new LoginProcess(this, loginConfiguration, authContext, coreServicesWrapper); if (coreServicesWrapper.isNewRequest(authContext)) { startLoginProcess(loginProcess); } return loginProcess; } @Inject  LoginAuthenticator(CoreServicesWrapper coreServicesWrapper); LoginProcess getLoginProcess(LoginConfiguration loginConfiguration); }
LoginAuthenticator { public LoginProcess getLoginProcess(LoginConfiguration loginConfiguration) throws AuthException, AuthLoginException, SSOException { verifyAuthenticationRealm(loginConfiguration.getHttpRequest()); AuthContextLocalWrapper authContext = getAuthContext(loginConfiguration); LoginProcess loginProcess = new LoginProcess(this, loginConfiguration, authContext, coreServicesWrapper); if (coreServicesWrapper.isNewRequest(authContext)) { startLoginProcess(loginProcess); } return loginProcess; } @Inject  LoginAuthenticator(CoreServicesWrapper coreServicesWrapper); LoginProcess getLoginProcess(LoginConfiguration loginConfiguration);  }