use of uk.gov.ida.hub.policy.domain.SessionId in project verify-hub by alphagov.
the class EidasCycle3DataResourceTest method shouldGetCycle3AttributeRequestDataFromConfiguration.
@Test
public void shouldGetCycle3AttributeRequestDataFromConfiguration() throws JsonProcessingException {
final SessionId sessionId = SessionIdBuilder.aSessionId().build();
final String rpEntityId = new EidasCycle3DTO(sessionId).getRequestIssuerEntityId();
final Response sessionCreatedResponse = createSessionInEidasAwaitingCycle3DataState(sessionId);
assertThat(sessionCreatedResponse.getStatus()).isEqualTo(Response.Status.OK.getStatusCode());
final MatchingProcessDto cycle3Attribute = new MatchingProcessDto(Optional.of("TUFTY_CLUB_CARD"));
configStub.setUpStubForEnteringAwaitingCycle3DataState(rpEntityId, cycle3Attribute);
samlSoapProxyProxyStub.setUpStubForSendHubMatchingServiceRequest(sessionId);
final Cycle3AttributeRequestData actualResponse = getCycle3Data(sessionId);
final Cycle3AttributeRequestData expectedResponse = aCycle3AttributeRequestData().withAttributeName(cycle3Attribute.getAttributeName().get()).withRequestIssuerId(rpEntityId).build();
assertThat(actualResponse).isEqualToComparingFieldByField(expectedResponse);
}
use of uk.gov.ida.hub.policy.domain.SessionId in project verify-hub by alphagov.
the class EidasMatchingServiceResourceIntegrationTest method shouldTransitionToNoMatchStateWhenNoMatchIsReceivedForEidasCycle0And1WithCycle3Disabled.
@Test
public void shouldTransitionToNoMatchStateWhenNoMatchIsReceivedForEidasCycle0And1WithCycle3Disabled() throws Exception {
final SessionId sessionId = aSessionIsCreated();
selectACountry(sessionId, NETHERLANDS);
samlSoapProxyProxyStub.setUpStubForSendHubMatchingServiceRequest(sessionId);
postAuthnResponseToPolicy(sessionId);
final InboundResponseFromMatchingServiceDto inboundResponseFromMatchingServiceDto = new InboundResponseFromMatchingServiceDto(MatchingServiceIdaStatus.NoMatchingServiceMatchFromMatchingService, translatedAuthnRequest.getId(), MSA_ENTITY_ID, Optional.absent(), Optional.absent());
samlEngineStub.setupStubForAttributeResponseTranslate(inboundResponseFromMatchingServiceDto);
configStub.setUpStubForCycle01NoMatchCycle3Disabled(RP_ENTITY_ID);
final Response response = postAttributeQueryResponseToPolicy(sessionId);
assertThat(response.getStatus()).isEqualTo(Response.Status.OK.getStatusCode());
assertThat(getSessionStateName(sessionId)).isEqualTo(NoMatchState.class.getName());
}
use of uk.gov.ida.hub.policy.domain.SessionId in project verify-hub by alphagov.
the class EidasMatchingServiceResourceIntegrationTest method shouldTransitionToEidasSuccessfulMatchStateWhenMatchIsReceivedForEidasCycle0And1.
@Test
public void shouldTransitionToEidasSuccessfulMatchStateWhenMatchIsReceivedForEidasCycle0And1() throws Exception {
final SessionId sessionId = aSessionIsCreated();
selectACountry(sessionId, NETHERLANDS);
samlSoapProxyProxyStub.setUpStubForSendHubMatchingServiceRequest(sessionId);
postAuthnResponseToPolicy(sessionId);
final InboundResponseFromMatchingServiceDto inboundResponseFromMatchingServiceDto = new InboundResponseFromMatchingServiceDto(MatchingServiceIdaStatus.MatchingServiceMatch, translatedAuthnRequest.getId(), MSA_ENTITY_ID, Optional.of("assertionBlob"), Optional.of(LevelOfAssurance.LEVEL_2));
samlEngineStub.setupStubForAttributeResponseTranslate(inboundResponseFromMatchingServiceDto);
final Response response = postAttributeQueryResponseToPolicy(sessionId);
assertThat(response.getStatus()).isEqualTo(Response.Status.OK.getStatusCode());
assertThat(getSessionStateName(sessionId)).isEqualTo(EidasSuccessfulMatchState.class.getName());
}
use of uk.gov.ida.hub.policy.domain.SessionId in project verify-hub by alphagov.
the class EidasSessionResourceIntegrationTest method selectACountry.
private SessionId selectACountry(EidasCountryDto dto) {
SessionId sessionId = createSessionInCountrySelectingState();
TestSessionResourceHelper.selectCountryInSession(sessionId, client, policy.uri(UriBuilder.fromPath(Urls.PolicyUrls.COUNTRIES_RESOURCE).path(Urls.PolicyUrls.COUNTRY_SET_PATH).build(sessionId, dto.getSimpleId()).toString()));
return sessionId;
}
use of uk.gov.ida.hub.policy.domain.SessionId in project verify-hub by alphagov.
the class EidasSessionResourceIntegrationTest method shouldReturnOkWhenSuccessAuthnResponseIsReceived.
@Test
public void shouldReturnOkWhenSuccessAuthnResponseIsReceived() throws Exception {
SessionId sessionId = selectACountry(NETHERLANDS);
samlSoapProxyProxyStub.setUpStubForSendHubMatchingServiceRequest(sessionId);
Response response = postAuthnResponseToPolicy(sessionId);
assertThat(response.getStatus()).isEqualTo(Response.Status.OK.getStatusCode());
ResponseAction expectedResult = ResponseAction.success(sessionId, false, LevelOfAssurance.LEVEL_2);
assertThat(response.readEntity(ResponseAction.class)).isEqualToComparingFieldByField(expectedResult);
assertThatCurrentStateForSesssionIs(sessionId, EidasCycle0And1MatchRequestSentState.class);
}
Aggregations