Search in sources :

Example 66 with SessionId

use of uk.gov.ida.hub.policy.domain.SessionId in project verify-hub by alphagov.

the class EidasSessionResourceIntegrationTest method shouldFailWhenCountryIsDisabledWhileInSession.

@Test
public void shouldFailWhenCountryIsDisabledWhileInSession() throws Exception {
    enableCountriesForRp(RP_ENTITY_ID, SPAIN);
    SessionId sessionId = selectACountry(NETHERLANDS);
    Response response = postAuthnResponseToPolicy(sessionId);
    assertThat(response.getStatus()).isEqualTo(Response.Status.BAD_REQUEST.getStatusCode());
}
Also used : Response(javax.ws.rs.core.Response) SessionId(uk.gov.ida.hub.policy.domain.SessionId) Test(org.junit.Test)

Example 67 with SessionId

use of uk.gov.ida.hub.policy.domain.SessionId in project verify-hub by alphagov.

the class EidasSessionResourceIntegrationTest method shouldFailWhenSessionIsInvalid.

@Test
public void shouldFailWhenSessionIsInvalid() throws Exception {
    SessionId sessionId = SessionId.createNewSessionId();
    Response response = postAuthnResponseToPolicy(sessionId);
    assertThat(response.getStatus()).isEqualTo(Response.Status.BAD_REQUEST.getStatusCode());
}
Also used : Response(javax.ws.rs.core.Response) SessionId(uk.gov.ida.hub.policy.domain.SessionId) Test(org.junit.Test)

Example 68 with SessionId

use of uk.gov.ida.hub.policy.domain.SessionId in project verify-hub by alphagov.

the class EidasSessionResourceIntegrationTest method shouldFailWhenLOAIsNotWhatWasRequested.

@Test
public void shouldFailWhenLOAIsNotWhatWasRequested() throws Exception {
    stubSamlEngineTranslationLOAForCountry(LevelOfAssurance.LEVEL_1, NETHERLANDS);
    SessionId sessionId = selectACountry(NETHERLANDS);
    Response response = postAuthnResponseToPolicy(sessionId);
    assertThat(response.getStatus()).isEqualTo(Response.Status.BAD_REQUEST.getStatusCode());
}
Also used : Response(javax.ws.rs.core.Response) SessionId(uk.gov.ida.hub.policy.domain.SessionId) Test(org.junit.Test)

Example 69 with SessionId

use of uk.gov.ida.hub.policy.domain.SessionId in project verify-hub by alphagov.

the class EidasSessionResourceIntegrationTest method createSessionInCountrySelectingState.

private SessionId createSessionInCountrySelectingState() {
    SessionId sessionId = SessionId.createNewSessionId();
    URI uri = policy.uri(UriBuilder.fromPath(TEST_SESSION_RESOURCE_PATH + COUNTRY_SELECTED_STATE).build().toASCIIString());
    TestSessionResourceHelper.createSessionInCountrySelectingState(sessionId, client, uri, RP_ENTITY_ID, true);
    return sessionId;
}
Also used : SessionId(uk.gov.ida.hub.policy.domain.SessionId) URI(java.net.URI)

Example 70 with SessionId

use of uk.gov.ida.hub.policy.domain.SessionId in project verify-hub by alphagov.

the class MatchingServiceResourcesIntegrationTest method responseProcessingDetails_shouldReturnSuccessResponse_whenNoMatchWithC3Enabled_userAccountCreationAttributesAreFetched.

@Test
public void responseProcessingDetails_shouldReturnSuccessResponse_whenNoMatchWithC3Enabled_userAccountCreationAttributesAreFetched() throws Exception {
    final SessionId sessionId = aSessionIsCreated();
    anIdpIsSelectedForRegistration(sessionId, idpEntityId);
    anIdpAuthnRequestWasGenerated(sessionId);
    anAuthnResponseFromIdpWasReceivedAndMatchingRequestSent(sessionId);
    aNoMatchResponseWasReceivedFromTheMSAForCycle01_withCycle3Enabled(sessionId);
    aCycle3AttributeHasBeenSentToPolicyFromTheUser(sessionId, "#1");
    aNoMatchResponseHasBeenReceivedAndUserAccountCreationIsEnabled(sessionId);
    URI uri = UriBuilder.fromPath(Urls.PolicyUrls.RESPONSE_PROCESSING_DETAILS_RESOURCE).build(sessionId);
    Response response = getResponse(policy.uri(uri.toASCIIString()));
    assertThat(response.getStatus()).isEqualTo(Response.Status.OK.getStatusCode());
    ResponseProcessingDetails responseProcessingDetails = response.readEntity(ResponseProcessingDetails.class);
    assertThat(responseProcessingDetails.getResponseProcessingStatus()).isEqualTo(ResponseProcessingStatus.WAIT);
    assertThat(responseProcessingDetails.getSessionId()).isEqualTo(sessionId);
    assertThat(getSessionStateName(sessionId)).isEqualTo(UserAccountCreationRequestSentState.class.getName());
}
Also used : Response(javax.ws.rs.core.Response) SessionId(uk.gov.ida.hub.policy.domain.SessionId) URI(java.net.URI) ResponseProcessingDetails(uk.gov.ida.hub.policy.domain.ResponseProcessingDetails) UserAccountCreationRequestSentState(uk.gov.ida.hub.policy.domain.state.UserAccountCreationRequestSentState) Test(org.junit.Test)

Aggregations

SessionId (uk.gov.ida.hub.policy.domain.SessionId)92 Test (org.junit.Test)83 Response (javax.ws.rs.core.Response)41 URI (java.net.URI)33 ResponseProcessingDetails (uk.gov.ida.hub.policy.domain.ResponseProcessingDetails)14 SessionId.createNewSessionId (uk.gov.ida.hub.policy.domain.SessionId.createNewSessionId)13 Cycle3MatchRequestSentState (uk.gov.ida.hub.policy.domain.state.Cycle3MatchRequestSentState)12 Matchers.anyString (org.mockito.Matchers.anyString)9 Cycle3MatchRequestSentStateBuilder.aCycle3MatchRequestSentState (uk.gov.ida.hub.policy.builder.state.Cycle3MatchRequestSentStateBuilder.aCycle3MatchRequestSentState)9 InboundResponseFromMatchingServiceDto (uk.gov.ida.hub.policy.contracts.InboundResponseFromMatchingServiceDto)6 MatchingServiceRequestErrorState (uk.gov.ida.hub.policy.domain.state.MatchingServiceRequestErrorState)6 SessionIdBuilder.aSessionId (uk.gov.ida.hub.policy.builder.domain.SessionIdBuilder.aSessionId)5 AuthnResponseFromHubContainerDto (uk.gov.ida.hub.policy.contracts.AuthnResponseFromHubContainerDto)5 Cycle3AttributeRequestData (uk.gov.ida.hub.policy.domain.Cycle3AttributeRequestData)5 EventSinkHubEvent (uk.gov.ida.hub.policy.domain.EventSinkHubEvent)5 NoMatchFromMatchingService (uk.gov.ida.hub.policy.domain.NoMatchFromMatchingService)5 ResponseFromHub (uk.gov.ida.hub.policy.domain.ResponseFromHub)5 SamlRequestDto (uk.gov.ida.hub.policy.contracts.SamlRequestDto)4 SamlResponseWithAuthnRequestInformationDto (uk.gov.ida.hub.policy.contracts.SamlResponseWithAuthnRequestInformationDto)4 AuthnRequestFromHubContainerDto (uk.gov.ida.hub.policy.domain.AuthnRequestFromHubContainerDto)4