use of uk.gov.ida.hub.policy.domain.AuthenticationErrorResponse in project verify-hub by alphagov.
the class AuthnResponseFromIdpService method handleCancelResponse.
private ResponseAction handleCancelResponse(InboundResponseFromIdpDto idaResponseFromIdp, SessionId sessionId, String principalIPAddressAsSeenByHub, IdpSelectedStateController idpSelectedStateController) {
AuthenticationErrorResponse noAuthenticationContextErrorResponse = new AuthenticationErrorResponse(idaResponseFromIdp.getIssuer(), principalIPAddressAsSeenByHub);
idpSelectedStateController.handleNoAuthenticationContextResponseFromIdp(noAuthenticationContextErrorResponse);
return cancel(sessionId, idpSelectedStateController.isRegistrationContext());
}
use of uk.gov.ida.hub.policy.domain.AuthenticationErrorResponse in project verify-hub by alphagov.
the class AuthnResponseFromIdpService method handleNoAuthnContextResponse.
private ResponseAction handleNoAuthnContextResponse(InboundResponseFromIdpDto idaResponseFromIdp, SessionId sessionId, String principalIPAddressAsSeenByHub, IdpSelectedStateController idpSelectedStateController) {
AuthenticationErrorResponse noAuthenticationContextErrorResponse = new AuthenticationErrorResponse(idaResponseFromIdp.getIssuer(), principalIPAddressAsSeenByHub);
idpSelectedStateController.handleNoAuthenticationContextResponseFromIdp(noAuthenticationContextErrorResponse);
return other(sessionId, idpSelectedStateController.isRegistrationContext());
}
use of uk.gov.ida.hub.policy.domain.AuthenticationErrorResponse in project verify-hub by alphagov.
the class IdpSelectedStateControllerTest method handleAuthnFailedResponseFromIdp_shouldLogEvent.
@Test
public void handleAuthnFailedResponseFromIdp_shouldLogEvent() {
AuthenticationErrorResponse authenticationErrorResponse = anAuthenticationErrorResponse().withIssuerId(IDP_ENTITY_ID).withPrincipalIpAddressAsSeenByHub(PRINCIPAL_IP_ADDRESS_AS_SEEN_BY_HUB).build();
when(identityProvidersConfigProxy.getEnabledIdentityProviders(TRANSACTION_ENTITY_ID, controller.isRegistrationContext(), PROVIDED_LOA)).thenReturn(singletonList(IDP_ENTITY_ID));
controller.handleAuthenticationFailedResponseFromIdp(authenticationErrorResponse);
verify(hubEventLogger).logIdpAuthnFailedEvent(NEW_SESSION_ID, TRANSACTION_ENTITY_ID, SESSION_EXPIRY_TIMESTAMP, REQUEST_ID, PRINCIPAL_IP_ADDRESS_AS_SEEN_BY_HUB);
}
use of uk.gov.ida.hub.policy.domain.AuthenticationErrorResponse in project verify-hub by alphagov.
the class AuthnResponseFromIdpServiceTest method verifyIdpStateControllerIsCalledWithRightDataOnNonFraudAuthenticationFailed.
private void verifyIdpStateControllerIsCalledWithRightDataOnNonFraudAuthenticationFailed(InboundResponseFromIdpDto authenticationFailedResponse) {
ArgumentCaptor<AuthenticationErrorResponse> captor = ArgumentCaptor.forClass(AuthenticationErrorResponse.class);
AuthenticationErrorResponse expectedAuthenticationErrorResponse = anAuthenticationErrorResponse().withIssuerId(authenticationFailedResponse.getIssuer()).withPrincipalIpAddressAsSeenByHub(samlAuthnResponseContainerDto.getPrincipalIPAddressAsSeenByHub()).build();
verify(idpSelectedStateController).handleAuthenticationFailedResponseFromIdp(captor.capture());
AuthenticationErrorResponse actualAuthenticationErrorResponse = captor.getValue();
assertThat(actualAuthenticationErrorResponse).isEqualToIgnoringGivenFields(expectedAuthenticationErrorResponse);
}
use of uk.gov.ida.hub.policy.domain.AuthenticationErrorResponse in project verify-hub by alphagov.
the class AuthnResponseFromIdpServiceTest method verifyIdpStateControllerIsCalledWithRightDataOnNonFraudNoAuthenticationContext.
private void verifyIdpStateControllerIsCalledWithRightDataOnNonFraudNoAuthenticationContext(InboundResponseFromIdpDto noAuthenticationContext) {
ArgumentCaptor<AuthenticationErrorResponse> captor = ArgumentCaptor.forClass(AuthenticationErrorResponse.class);
AuthenticationErrorResponse expectedAuthenticationErrorResponse = anAuthenticationErrorResponse().withIssuerId(noAuthenticationContext.getIssuer()).withPrincipalIpAddressAsSeenByHub(samlAuthnResponseContainerDto.getPrincipalIPAddressAsSeenByHub()).build();
verify(idpSelectedStateController).handleNoAuthenticationContextResponseFromIdp(captor.capture());
AuthenticationErrorResponse actualAuthenticationErrorResponse = captor.getValue();
assertThat(actualAuthenticationErrorResponse).isEqualToIgnoringGivenFields(expectedAuthenticationErrorResponse);
}
Aggregations