use of uk.gov.ida.hub.policy.domain.SuccessFromIdp in project verify-hub by alphagov.
the class IdpSelectedStateControllerTest method handleSuccessResponseFromIdp_shouldThrowExceptionWhenReturnedLOAIsUnsupportedByIdpConfig.
@Test(expected = StateProcessingValidationException.class)
public void handleSuccessResponseFromIdp_shouldThrowExceptionWhenReturnedLOAIsUnsupportedByIdpConfig() {
PersistentId persistentId = aPersistentId().withNameId("idname").build();
SuccessFromIdp successFromIdp = aSuccessFromIdp().withIssuerId(IDP_ENTITY_ID).withPersistentId(persistentId).withPrincipalIpAddressSeenByIdp(PRINCIPAL_IP_ADDRESS_AS_SEEN_BY_IDP).withPrincipalIpAddressAsSeenByHub(PRINCIPAL_IP_ADDRESS_AS_SEEN_BY_HUB).withLevelOfAssurance(LevelOfAssurance.LEVEL_3).build();
when(identityProvidersConfigProxy.getEnabledIdentityProviders(TRANSACTION_ENTITY_ID, controller.isRegistrationContext(), PROVIDED_LOA)).thenReturn(singletonList(IDP_ENTITY_ID));
when(policyConfiguration.getMatchingServiceResponseWaitPeriod()).thenReturn(new org.joda.time.Duration(600L));
when(identityProvidersConfigProxy.getIdpConfig(IDP_ENTITY_ID)).thenReturn(anIdpConfigDto().withLevelsOfAssurance(LEVELS_OF_ASSURANCE).build());
controller.handleSuccessResponseFromIdp(successFromIdp);
}
use of uk.gov.ida.hub.policy.domain.SuccessFromIdp in project verify-hub by alphagov.
the class AuthnResponseFromIdpServiceTest method verifyIdpStateControllerIsCalledWithRightDataOnSuccess.
private void verifyIdpStateControllerIsCalledWithRightDataOnSuccess(InboundResponseFromIdpDto successResponseFromIdp) {
ArgumentCaptor<SuccessFromIdp> captor = ArgumentCaptor.forClass(SuccessFromIdp.class);
PersistentId persistentId = PersistentIdBuilder.aPersistentId().withNameId(successResponseFromIdp.getPersistentId().get()).build();
SuccessFromIdp expectedSuccessFromIdp = SuccessFromIdpBuilder.aSuccessFromIdp().withIssuerId(successResponseFromIdp.getIssuer()).withEncryptedMatchingDatasetAssertion(successResponseFromIdp.getEncryptedMatchingDatasetAssertion().get()).withAuthnStatementAssertion(successResponseFromIdp.getAuthnStatementAssertionBlob().get()).withPersistentId(persistentId).withLevelOfAssurance(successResponseFromIdp.getLevelOfAssurance().get()).withPrincipalIpAddressAsSeenByHub(samlAuthnResponseContainerDto.getPrincipalIPAddressAsSeenByHub()).withPrincipalIpAddressSeenByIdp(successResponseFromIdp.getPrincipalIpAddressAsSeenByIdp().get()).build();
verify(idpSelectedStateController).handleSuccessResponseFromIdp(captor.capture());
SuccessFromIdp actualSuccessFromIdp = captor.getValue();
assertThat(actualSuccessFromIdp).isEqualToIgnoringGivenFields(expectedSuccessFromIdp, "persistentId");
assertThat(actualSuccessFromIdp.getPersistentId().getNameId()).isEqualTo(persistentId.getNameId());
}
Aggregations