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;
}
Aggregations