use of uk.gov.ida.hub.policy.domain.AuthenticationErrorResponse in project verify-hub by alphagov.
the class IdpSelectedStateControllerTest method handleNoAuthnContextResponseFromIdp_shouldLogEvent.
@Test
public void handleNoAuthnContextResponseFromIdp_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.handleNoAuthenticationContextResponseFromIdp(authenticationErrorResponse);
verify(hubEventLogger).logNoAuthnContextEvent(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 IdpSelectedStateControllerTest method handleNoAuthenticationContextResponseFromIdp_shouldTransitionToAuthnFailedErrorStateWhenRegistrationCancelled.
@Test
public void handleNoAuthenticationContextResponseFromIdp_shouldTransitionToAuthnFailedErrorStateWhenRegistrationCancelled() {
controller = idpSelectedStateBuilder(true);
AuthenticationErrorResponse authenticationErrorResponse = anAuthenticationErrorResponse().withIssuerId(IDP_ENTITY_ID).build();
when(identityProvidersConfigProxy.getEnabledIdentityProviders(any(String.class), eq(controller.isRegistrationContext()), eq(PROVIDED_LOA))).thenReturn(singletonList(authenticationErrorResponse.getIssuer()));
controller.handleNoAuthenticationContextResponseFromIdp(authenticationErrorResponse);
verify(stateTransitionAction).transitionTo(isA(AuthnFailedErrorState.class));
}
use of uk.gov.ida.hub.policy.domain.AuthenticationErrorResponse in project verify-hub by alphagov.
the class IdpSelectedStateControllerTest method handleNoAuthenticationContextResponseFromIdp_shouldThrowExceptionWhenIdpIsDisabled.
@Test(expected = IdpDisabledException.class)
public void handleNoAuthenticationContextResponseFromIdp_shouldThrowExceptionWhenIdpIsDisabled() {
AuthenticationErrorResponse authenticationErrorResponse = anAuthenticationErrorResponse().build();
when(identityProvidersConfigProxy.getEnabledIdentityProviders(TRANSACTION_ENTITY_ID, controller.isRegistrationContext(), PROVIDED_LOA)).thenReturn(emptyList());
controller.handleNoAuthenticationContextResponseFromIdp(authenticationErrorResponse);
}
use of uk.gov.ida.hub.policy.domain.AuthenticationErrorResponse in project verify-hub by alphagov.
the class IdpSelectedStateControllerTest method handleAuthenticationFailedResponseFromIdp_shouldThrowExceptionWhenIdpIsDisabled.
@Test(expected = IdpDisabledException.class)
public void handleAuthenticationFailedResponseFromIdp_shouldThrowExceptionWhenIdpIsDisabled() {
AuthenticationErrorResponse authenticationErrorResponse = anAuthenticationErrorResponse().build();
when(identityProvidersConfigProxy.getEnabledIdentityProviders(TRANSACTION_ENTITY_ID, controller.isRegistrationContext(), PROVIDED_LOA)).thenReturn(emptyList());
controller.handleAuthenticationFailedResponseFromIdp(authenticationErrorResponse);
}
use of uk.gov.ida.hub.policy.domain.AuthenticationErrorResponse in project verify-hub by alphagov.
the class IdpSelectedStateControllerTest method handleResponseFromIdp_shouldTransitionToAuthnFailedStateWhenAGenericAuthenticationFailureHasOccurred.
@Test
public void handleResponseFromIdp_shouldTransitionToAuthnFailedStateWhenAGenericAuthenticationFailureHasOccurred() {
when(identityProvidersConfigProxy.getEnabledIdentityProviders(TRANSACTION_ENTITY_ID, controller.isRegistrationContext(), PROVIDED_LOA)).thenReturn(singletonList(IDP_ENTITY_ID));
AuthenticationErrorResponse authenticationErrorResponse = anAuthenticationErrorResponse().withIssuerId(IDP_ENTITY_ID).build();
controller.handleAuthenticationFailedResponseFromIdp(authenticationErrorResponse);
ArgumentCaptor<State> stateArgumentCaptor = ArgumentCaptor.forClass(State.class);
verify(stateTransitionAction).transitionTo(stateArgumentCaptor.capture());
assertThat(stateArgumentCaptor.getValue()).isInstanceOf(AuthnFailedErrorState.class);
}
Aggregations