use of uk.gov.ida.hub.policy.domain.ResponseFromHub in project verify-hub by alphagov.
the class SessionService method getRpErrorResponse.
public AuthnResponseFromHubContainerDto getRpErrorResponse(SessionId sessionId) {
getSessionIfItExists(sessionId);
final ResponseFromHub errorResponseFromHub = authnRequestHandler.getErrorResponseFromHub(sessionId);
final RequestForErrorResponseFromHubDto requestForErrorResponseFromHubDto = new RequestForErrorResponseFromHubDto(errorResponseFromHub.getAuthnRequestIssuerEntityId(), errorResponseFromHub.getResponseId(), errorResponseFromHub.getInResponseTo(), errorResponseFromHub.getAssertionConsumerServiceUri(), errorResponseFromHub.getStatus());
final SamlMessageDto samlMessageDto = samlEngineProxy.generateErrorResponseFromHub(requestForErrorResponseFromHubDto);
final AuthnResponseFromHubContainerDto authnResponseFromHubContainerDto = new AuthnResponseFromHubContainerDto(samlMessageDto.getSamlMessage(), errorResponseFromHub.getAssertionConsumerServiceUri(), errorResponseFromHub.getRelayState(), errorResponseFromHub.getResponseId());
return authnResponseFromHubContainerDto;
}
use of uk.gov.ida.hub.policy.domain.ResponseFromHub in project verify-hub by alphagov.
the class SessionService method getRpAuthnResponse.
public AuthnResponseFromHubContainerDto getRpAuthnResponse(SessionId sessionId) {
getSessionIfItExists(sessionId);
ResponseFromHub responseFromHub = authnRequestHandler.getResponseFromHub(sessionId);
return samlEngineProxy.generateRpAuthnResponse(responseFromHub);
}
use of uk.gov.ida.hub.policy.domain.ResponseFromHub in project verify-hub by alphagov.
the class Cycle0And1MatchRequestSentStateControllerTest method shouldReturnErrorResponseWhenAskedAndInCycle0And1MatchRequestSentState.
@Test
public void shouldReturnErrorResponseWhenAskedAndInCycle0And1MatchRequestSentState() {
final ResponseFromHub responseFromHub = controller.getErrorResponse();
assertThat(responseFromHub.getStatus()).isEqualTo(TransactionIdaStatus.NoAuthenticationContext);
}
use of uk.gov.ida.hub.policy.domain.ResponseFromHub in project verify-hub by alphagov.
the class Cycle3MatchRequestSentStateControllerTest method shouldReturnErrorResponseWhenAskedAndInCycle3MatchRequestSentState.
@Test
public void shouldReturnErrorResponseWhenAskedAndInCycle3MatchRequestSentState() {
final String requestId = "requestId";
final SessionId sessionId = SessionId.createNewSessionId();
Cycle3MatchRequestSentState state = aCycle3MatchRequestSentState().withSessionId(sessionId).withRequestId(requestId).build();
Cycle3MatchRequestSentStateController controller = new Cycle3MatchRequestSentStateController(state, hubEventLogger, stateTransitionAction, policyConfiguration, null, responseFromHubFactory, transactionsConfigProxy, matchingServiceConfigProxy, assertionRestrictionFactory, attributeQueryService);
when(policyConfiguration.getMatchingServiceResponseWaitPeriod()).thenReturn(Duration.standardMinutes(5));
final ResponseFromHub responseFromHub = controller.getErrorResponse();
assertThat(responseFromHub.getStatus()).isEqualTo(TransactionIdaStatus.NoAuthenticationContext);
}
use of uk.gov.ida.hub.policy.domain.ResponseFromHub in project verify-hub by alphagov.
the class EidasAwaitingCycle3DataStateControllerTest method getErrorResponse.
@Test
public void getErrorResponse() throws Exception {
when(idGenerator.getId()).thenReturn(RESPONSE_ID);
ResponseFromHub expectedResponse = new ResponseFromHub(RESPONSE_ID, state.getRequestId(), state.getRequestIssuerEntityId(), Optional.absent(), Optional.of("relayState"), URI.create("assertionConsumerServiceUri"), TransactionIdaStatus.NoAuthenticationContext);
ResponseFromHub actualResponse = controller.getErrorResponse();
assertThat(actualResponse).isEqualTo(expectedResponse);
}
Aggregations