Search in sources :

Example 6 with InboundResponseFromMatchingServiceDto

use of uk.gov.ida.hub.policy.contracts.InboundResponseFromMatchingServiceDto in project verify-hub by alphagov.

the class MatchingServiceResourcesIntegrationTest method aUserAccountCreationResponseIsReceived.

private void aUserAccountCreationResponseIsReceived(SessionId sessionId, MatchingServiceIdaStatus status) throws JsonProcessingException {
    SamlResponseDto msaSamlResponseDto = new SamlResponseDto("a-saml-response");
    InboundResponseFromMatchingServiceDto inboundResponseFromMatchingServiceDto = new InboundResponseFromMatchingServiceDto(status, translatedAuthnRequest.getId(), msaEntityId, Optional.of("assertionBlob"), Optional.of(LEVEL_2));
    samlEngineStub.setupStubForAttributeResponseTranslate(inboundResponseFromMatchingServiceDto);
    URI uri = UriBuilder.fromPath(Urls.PolicyUrls.ATTRIBUTE_QUERY_RESPONSE_RESOURCE).build(sessionId);
    postResponse(policy.uri(uri.toASCIIString()), msaSamlResponseDto);
}
Also used : SamlResponseDto(uk.gov.ida.hub.policy.contracts.SamlResponseDto) URI(java.net.URI) InboundResponseFromMatchingServiceDto(uk.gov.ida.hub.policy.contracts.InboundResponseFromMatchingServiceDto)

Example 7 with InboundResponseFromMatchingServiceDto

use of uk.gov.ida.hub.policy.contracts.InboundResponseFromMatchingServiceDto in project verify-hub by alphagov.

the class MatchingServiceResourcesIntegrationTest method aNoMatchResponseWasReceivedFromTheMSAForCycle01_withCycle3Enabled.

private String aNoMatchResponseWasReceivedFromTheMSAForCycle01_withCycle3Enabled(SessionId sessionId) throws JsonProcessingException {
    SamlResponseDto msaSamlResponseDto = new SamlResponseDto("a-saml-response");
    InboundResponseFromMatchingServiceDto inboundResponseFromMatchingServiceDto = new InboundResponseFromMatchingServiceDto(MatchingServiceIdaStatus.NoMatchingServiceMatchFromMatchingService, translatedAuthnRequest.getId(), msaEntityId, Optional.<String>absent(), Optional.<LevelOfAssurance>absent());
    samlEngineStub.setupStubForAttributeResponseTranslate(inboundResponseFromMatchingServiceDto);
    final String cycle3Attribute = configStub.setUpStubForEnteringAwaitingCycle3DataState(rpEntityId);
    URI uri = UriBuilder.fromPath(Urls.PolicyUrls.ATTRIBUTE_QUERY_RESPONSE_RESOURCE).build(sessionId);
    postResponse(policy.uri(uri.toASCIIString()), msaSamlResponseDto);
    return cycle3Attribute;
}
Also used : SamlResponseDto(uk.gov.ida.hub.policy.contracts.SamlResponseDto) URI(java.net.URI) InboundResponseFromMatchingServiceDto(uk.gov.ida.hub.policy.contracts.InboundResponseFromMatchingServiceDto)

Example 8 with InboundResponseFromMatchingServiceDto

use of uk.gov.ida.hub.policy.contracts.InboundResponseFromMatchingServiceDto in project verify-hub by alphagov.

the class MatchingServiceResourcesIntegrationTest method aNoMatchResponseWasReceivedFromTheMSAForCycle01_withCycle3Disabled.

private void aNoMatchResponseWasReceivedFromTheMSAForCycle01_withCycle3Disabled(SessionId sessionId) throws JsonProcessingException {
    SamlResponseDto msaSamlResponseDto = new SamlResponseDto("a-saml-response");
    InboundResponseFromMatchingServiceDto inboundResponseFromMatchingServiceDto = new InboundResponseFromMatchingServiceDto(MatchingServiceIdaStatus.NoMatchingServiceMatchFromMatchingService, translatedAuthnRequest.getId(), msaEntityId, Optional.<String>absent(), Optional.<LevelOfAssurance>absent());
    samlEngineStub.setupStubForAttributeResponseTranslate(inboundResponseFromMatchingServiceDto);
    configStub.setUpStubForCycle01NoMatchCycle3Disabled(rpEntityId);
    List<UserAccountCreationAttribute> userAccountCreationAttributes = ImmutableList.of(UserAccountCreationAttribute.CURRENT_ADDRESS);
    configStub.setUpStubForUserAccountCreation(rpEntityId, userAccountCreationAttributes);
    URI uri = UriBuilder.fromPath(Urls.PolicyUrls.ATTRIBUTE_QUERY_RESPONSE_RESOURCE).build(sessionId);
    postResponse(policy.uri(uri.toASCIIString()), msaSamlResponseDto);
}
Also used : SamlResponseDto(uk.gov.ida.hub.policy.contracts.SamlResponseDto) UserAccountCreationAttribute(uk.gov.ida.hub.policy.domain.UserAccountCreationAttribute) URI(java.net.URI) InboundResponseFromMatchingServiceDto(uk.gov.ida.hub.policy.contracts.InboundResponseFromMatchingServiceDto)

Example 9 with InboundResponseFromMatchingServiceDto

use of uk.gov.ida.hub.policy.contracts.InboundResponseFromMatchingServiceDto in project verify-hub by alphagov.

the class MatchingServiceResponseServiceTest method handle_shouldNotifyPolicyWhenTransformationSucceedsForAMatch.

@Test
public void handle_shouldNotifyPolicyWhenTransformationSucceedsForAMatch() {
    final InboundResponseFromMatchingServiceDto inboundResponseFromMatchingServiceDto = new InboundResponseFromMatchingServiceDto(MatchingServiceIdaStatus.MatchingServiceMatch, inResponseTo, "issuer", Optional.of("assertionBlob"), Optional.of(LevelOfAssurance.LEVEL_2));
    when(samlEngineProxy.translateMatchingServiceResponse(samlResponseDto)).thenReturn(inboundResponseFromMatchingServiceDto);
    matchingServiceResponseService.handleSuccessResponse(sessionId, samlResponseDto);
    verify(waitingForMatchingServiceResponseStateController, times(1)).handleMatchResponseFromMatchingService(Matchers.<MatchFromMatchingService>any());
}
Also used : InboundResponseFromMatchingServiceDto(uk.gov.ida.hub.policy.contracts.InboundResponseFromMatchingServiceDto) Test(org.junit.Test)

Example 10 with InboundResponseFromMatchingServiceDto

use of uk.gov.ida.hub.policy.contracts.InboundResponseFromMatchingServiceDto in project verify-hub by alphagov.

the class MatchingServiceResponseServiceTest method handle_shouldNotifyPolicyWhenTransformationSucceedsForUserAccountCreated.

@Test
public void handle_shouldNotifyPolicyWhenTransformationSucceedsForUserAccountCreated() {
    final InboundResponseFromMatchingServiceDto inboundResponseFromMatchingServiceDto = new InboundResponseFromMatchingServiceDto(MatchingServiceIdaStatus.UserAccountCreated, inResponseTo, "issuer", Optional.of("assertionBlob"), Optional.of(LevelOfAssurance.LEVEL_2));
    when(samlEngineProxy.translateMatchingServiceResponse(samlResponseDto)).thenReturn(inboundResponseFromMatchingServiceDto);
    matchingServiceResponseService.handleSuccessResponse(sessionId, samlResponseDto);
    verify(waitingForMatchingServiceResponseStateController, times(1)).handleUserAccountCreatedResponseFromMatchingService(Matchers.<UserAccountCreatedFromMatchingService>any());
}
Also used : InboundResponseFromMatchingServiceDto(uk.gov.ida.hub.policy.contracts.InboundResponseFromMatchingServiceDto) Test(org.junit.Test)

Aggregations

InboundResponseFromMatchingServiceDto (uk.gov.ida.hub.policy.contracts.InboundResponseFromMatchingServiceDto)15 Test (org.junit.Test)10 URI (java.net.URI)7 SamlResponseDto (uk.gov.ida.hub.policy.contracts.SamlResponseDto)7 Response (javax.ws.rs.core.Response)6 SessionId (uk.gov.ida.hub.policy.domain.SessionId)6 UserAccountCreationAttribute (uk.gov.ida.hub.policy.domain.UserAccountCreationAttribute)2 ApplicationException (uk.gov.ida.exceptions.ApplicationException)1 Cycle0And1MatchRequestSentState (uk.gov.ida.hub.policy.domain.state.Cycle0And1MatchRequestSentState)1 Cycle3MatchRequestSentState (uk.gov.ida.hub.policy.domain.state.Cycle3MatchRequestSentState)1 EidasAwaitingCycle3DataState (uk.gov.ida.hub.policy.domain.state.EidasAwaitingCycle3DataState)1 EidasSuccessfulMatchState (uk.gov.ida.hub.policy.domain.state.EidasSuccessfulMatchState)1 NoMatchState (uk.gov.ida.hub.policy.domain.state.NoMatchState)1 SuccessfulMatchState (uk.gov.ida.hub.policy.domain.state.SuccessfulMatchState)1