use of uk.gov.ida.hub.policy.domain.ResponseFromHub in project verify-hub by alphagov.
the class ErrorStateControllerTests method shouldReturnErrorResponseWhenAskedAndInCycle3MatchRequestSentState.
@Test
public void shouldReturnErrorResponseWhenAskedAndInCycle3MatchRequestSentState() {
Cycle3MatchRequestSentState state = Cycle3MatchRequestSentStateBuilder.aCycle3MatchRequestSentState().build();
StateController stateController = new Cycle3MatchRequestSentStateController(state, hubEventLogger, stateTransitionAction, policyConfiguration, levelOfAssuranceValidator, responseFromHubFactory, transactionsConfigProxy, matchingServiceConfigProxy, assertionRestrictionFactory, attributeQueryService);
when(sessionRepository.getStateController(sessionId, ErrorResponsePreparedState.class)).thenReturn(stateController);
ResponseFromHub responseFromHub = authnRequestFromTransactionHandler.getErrorResponseFromHub(sessionId);
assertThat(responseFromHub.getStatus()).isEqualTo(TransactionIdaStatus.NoAuthenticationContext);
}
use of uk.gov.ida.hub.policy.domain.ResponseFromHub in project verify-hub by alphagov.
the class ErrorStateControllerTests method shouldReturnErrorResponseWhenAskedAndInRequesterErrorState.
@Test
public void shouldReturnErrorResponseWhenAskedAndInRequesterErrorState() {
RequesterErrorState state = RequesterErrorStateBuilder.aRequesterErrorState().build();
StateController stateController = new RequesterErrorStateController(state, responseFromHubFactory, stateTransitionAction, transactionsConfigProxy, identityProvidersConfigProxy, hubEventLogger);
when(sessionRepository.getStateController(sessionId, ErrorResponsePreparedState.class)).thenReturn(stateController);
ResponseFromHub responseFromHub = authnRequestFromTransactionHandler.getErrorResponseFromHub(sessionId);
assertThat(responseFromHub.getStatus()).isEqualTo(TransactionIdaStatus.NoAuthenticationContext);
}
use of uk.gov.ida.hub.policy.domain.ResponseFromHub in project verify-hub by alphagov.
the class ErrorStateControllerTests method shouldReturnErrorResponseWhenAskedAndInCycle0And1MatchRequestSentState.
@Test
public void shouldReturnErrorResponseWhenAskedAndInCycle0And1MatchRequestSentState() {
Cycle0And1MatchRequestSentState state = Cycle0And1MatchRequestSentStateBuilder.aCycle0And1MatchRequestSentState().build();
StateController stateController = new Cycle0And1MatchRequestSentStateController(state, hubEventLogger, stateTransitionAction, policyConfiguration, levelOfAssuranceValidator, transactionsConfigProxy, responseFromHubFactory, assertionRestrictionFactory, matchingServiceConfigProxy, attributeQueryService);
when(sessionRepository.getStateController(sessionId, ErrorResponsePreparedState.class)).thenReturn(stateController);
ResponseFromHub responseFromHub = authnRequestFromTransactionHandler.getErrorResponseFromHub(sessionId);
assertThat(responseFromHub.getStatus()).isEqualTo(TransactionIdaStatus.NoAuthenticationContext);
}
use of uk.gov.ida.hub.policy.domain.ResponseFromHub in project verify-hub by alphagov.
the class ErrorStateControllerTests method shouldReturnErrorResponseWhenAskedAndInUserAccountCreatedState.
@Test
public void shouldReturnErrorResponseWhenAskedAndInUserAccountCreatedState() {
UserAccountCreatedState state = UserAccountCreatedStateBuilder.aUserAccountCreatedState().build();
StateController stateController = new UserAccountCreatedStateController(state, identityProvidersConfigProxy, responseFromHubFactory);
when(sessionRepository.getStateController(sessionId, ErrorResponsePreparedState.class)).thenReturn(stateController);
ResponseFromHub responseFromHub = authnRequestFromTransactionHandler.getErrorResponseFromHub(sessionId);
assertThat(responseFromHub.getStatus()).isEqualTo(TransactionIdaStatus.NoAuthenticationContext);
}
use of uk.gov.ida.hub.policy.domain.ResponseFromHub in project verify-hub by alphagov.
the class SessionServiceTest method sendErrorResponseFromHub_shouldReturnDtoWithSamlRequestPostLocationAndRelayState.
@Test
public void sendErrorResponseFromHub_shouldReturnDtoWithSamlRequestPostLocationAndRelayState() throws Exception {
SessionId sessionId = createNewSessionId();
when(sessionRepository.sessionExists(sessionId)).thenReturn(true);
ResponseFromHub responseFromHub = aResponseFromHubDto().withRelayState("relayState").build();
when(authnRequestHandler.getErrorResponseFromHub(sessionId)).thenReturn(responseFromHub);
final SamlMessageDto samlMessageDto = new SamlMessageDto("saml");
when(samlEngineProxy.generateErrorResponseFromHub(any())).thenReturn(samlMessageDto);
AuthnResponseFromHubContainerDto dto = service.getRpErrorResponse(sessionId);
assertThat(dto.getSamlResponse()).isEqualTo(samlMessageDto.getSamlMessage());
assertThat(dto.getPostEndpoint()).isEqualTo(responseFromHub.getAssertionConsumerServiceUri());
assertThat(dto.getRelayState()).isEqualTo(responseFromHub.getRelayState());
assertThat(dto.getResponseId()).isEqualTo(responseFromHub.getResponseId());
}
Aggregations