Search in sources :

Example 1 with IdpSelectedStateController

use of uk.gov.ida.hub.policy.domain.controller.IdpSelectedStateController in project verify-hub by alphagov.

the class AuthnResponseFromIdpService method receiveAuthnResponseFromIdp.

public ResponseAction receiveAuthnResponseFromIdp(SessionId sessionId, SamlAuthnResponseContainerDto samlResponseDto) {
    IdpSelectedStateController idpSelectedController = (IdpSelectedStateController) sessionRepository.getStateController(sessionId, IdpSelectedState.class);
    String matchingServiceEntityId = idpSelectedController.getMatchingServiceEntityId();
    final SamlAuthnResponseTranslatorDto samlAuthnResponseTranslatorDto = samlAuthnResponseTranslatorDtoFactory.fromSamlAuthnResponseContainerDto(samlResponseDto, matchingServiceEntityId);
    final InboundResponseFromIdpDto idaResponseFromIdpDto = samlEngineProxy.translateAuthnResponseFromIdp(samlAuthnResponseTranslatorDto);
    final String principalIPAddressAsSeenByHub = samlResponseDto.getPrincipalIPAddressAsSeenByHub();
    ResponseAction responseAction;
    if (isFraudulent(idaResponseFromIdpDto)) {
        responseAction = handleFraudResponse(idaResponseFromIdpDto, sessionId, principalIPAddressAsSeenByHub, idpSelectedController);
    } else {
        responseAction = handleNonFraudResponse(idaResponseFromIdpDto, sessionId, principalIPAddressAsSeenByHub, idpSelectedController);
    }
    return responseAction;
}
Also used : IdpSelectedStateController(uk.gov.ida.hub.policy.domain.controller.IdpSelectedStateController) InboundResponseFromIdpDto(uk.gov.ida.hub.policy.domain.InboundResponseFromIdpDto) SamlAuthnResponseTranslatorDto(uk.gov.ida.hub.policy.contracts.SamlAuthnResponseTranslatorDto) IdpSelectedState(uk.gov.ida.hub.policy.domain.state.IdpSelectedState) ResponseAction(uk.gov.ida.hub.policy.domain.ResponseAction)

Aggregations

SamlAuthnResponseTranslatorDto (uk.gov.ida.hub.policy.contracts.SamlAuthnResponseTranslatorDto)1 InboundResponseFromIdpDto (uk.gov.ida.hub.policy.domain.InboundResponseFromIdpDto)1 ResponseAction (uk.gov.ida.hub.policy.domain.ResponseAction)1 IdpSelectedStateController (uk.gov.ida.hub.policy.domain.controller.IdpSelectedStateController)1 IdpSelectedState (uk.gov.ida.hub.policy.domain.state.IdpSelectedState)1