use of uk.gov.ida.hub.policy.domain.Cycle3Dataset in project verify-hub by alphagov.
the class Cycle3Service method sendCycle3MatchingRequest.
public void sendCycle3MatchingRequest(SessionId sessionId, Cycle3UserInput cycle3UserInput) {
AbstractAwaitingCycle3DataStateController controller = (AbstractAwaitingCycle3DataStateController) sessionRepository.getStateController(sessionId, AbstractAwaitingCycle3DataState.class);
String attributeName = controller.getCycle3AttributeRequestData().getAttributeName();
Cycle3Dataset cycle3Dataset = Cycle3Dataset.createFromData(attributeName, cycle3UserInput.getCycle3Input());
AbstractAttributeQueryRequestDto attributeQuery = controller.createAttributeQuery(cycle3Dataset);
attributeQueryService.sendAttributeQueryRequest(sessionId, attributeQuery);
controller.handleCycle3DataSubmitted(cycle3UserInput.getPrincipalIpAddress());
}
use of uk.gov.ida.hub.policy.domain.Cycle3Dataset in project verify-hub by alphagov.
the class EidasAttributeQueryRequestDtoBuilderTest method build.
@Test
public void build() throws Exception {
Map<String, String> map = new HashMap<>();
map.put("attribute", "attributeValue");
EidasAttributeQueryRequestDto eidasAttributeQueryRequestDto = EidasAttributeQueryRequestDtoBuilder.anEidasAttributeQueryRequestDto().build();
assertThat(eidasAttributeQueryRequestDto.getRequestId()).isEqualTo("requestId");
assertThat(eidasAttributeQueryRequestDto.getPersistentId()).isEqualTo(new PersistentId("nameId"));
assertThat(eidasAttributeQueryRequestDto.getEncryptedIdentityAssertion()).isEqualTo("encryptedIdentityAssertion");
assertThat(eidasAttributeQueryRequestDto.getAssertionConsumerServiceUri()).isEqualTo(URI.create("assertionConsumerServiceUri"));
assertThat(eidasAttributeQueryRequestDto.getAuthnRequestIssuerEntityId()).isEqualTo("authnRequestIssuesEntityId");
assertThat(eidasAttributeQueryRequestDto.getLevelOfAssurance()).isEqualTo(LevelOfAssurance.LEVEL_2);
assertThat(eidasAttributeQueryRequestDto.getAttributeQueryUri()).isEqualTo(URI.create("matchingServiceAdapterUri"));
assertThat(eidasAttributeQueryRequestDto.getMatchingServiceEntityId()).isEqualTo("matchingServiceAdapterEntityId");
assertThat(eidasAttributeQueryRequestDto.getMatchingServiceRequestTimeOut()).isEqualTo(DateTime.now().plusHours(1));
assertThat(eidasAttributeQueryRequestDto.isOnboarding()).isTrue();
assertThat(eidasAttributeQueryRequestDto.getCycle3Dataset()).isEqualTo(Optional.of(new Cycle3Dataset(map)));
assertThat(eidasAttributeQueryRequestDto.getUserAccountCreationAttributes()).isEqualTo(Optional.absent());
assertThat(eidasAttributeQueryRequestDto.getAssertionExpiry()).isEqualTo(DateTime.now().plusHours(2));
}
use of uk.gov.ida.hub.policy.domain.Cycle3Dataset in project verify-hub by alphagov.
the class EidasAwaitingCycle3DataStateControllerTest method createAttributeQuery.
@Test
public void createAttributeQuery() {
final Cycle3Dataset cycle3Dataset = Cycle3Dataset.createFromData("attribute", "attributeValue");
final MatchingServiceConfigEntityDataDto matchingServiceConfigEntityDataDto = aMatchingServiceConfigEntityDataDto().withEntityId(state.getMatchingServiceEntityId()).build();
when(matchingServiceConfigProxy.getMatchingService(state.getMatchingServiceEntityId())).thenReturn(matchingServiceConfigEntityDataDto);
when(policyConfiguration.getMatchingServiceResponseWaitPeriod()).thenReturn(Duration.standardMinutes(60));
when(assertionRestrictionsFactory.getAssertionExpiry()).thenReturn(DateTime.now().plusHours(2));
final EidasAttributeQueryRequestDto expectedDto = new EidasAttributeQueryRequestDto(state.getRequestId(), state.getRequestIssuerEntityId(), state.getAssertionConsumerServiceUri(), assertionRestrictionsFactory.getAssertionExpiry(), state.getMatchingServiceEntityId(), matchingServiceConfigEntityDataDto.getUri(), DateTime.now().plus(policyConfiguration.getMatchingServiceResponseWaitPeriod()), matchingServiceConfigEntityDataDto.isOnboarding(), state.getLevelOfAssurance(), state.getPersistentId(), Optional.of(cycle3Dataset), Optional.absent(), state.getEncryptedIdentityAssertion());
EidasAttributeQueryRequestDto actualDto = controller.createAttributeQuery(cycle3Dataset);
assertThat(actualDto).isEqualTo(expectedDto);
}
Aggregations