use of uk.gov.ida.hub.samlengine.exceptions.UnableToGenerateSamlException in project verify-hub by alphagov.
the class RpErrorResponseGeneratorService method generate.
public SamlMessageDto generate(RequestForErrorResponseFromHubDto requestForErrorResponseFromHubDto) {
try {
final OutboundResponseFromHub response = new OutboundResponseFromHub(requestForErrorResponseFromHubDto.getResponseId(), requestForErrorResponseFromHubDto.getInResponseTo(), hubEntityId, DateTime.now(), TransactionIdaStatus.valueOf(requestForErrorResponseFromHubDto.getStatus().name()), empty(), requestForErrorResponseFromHubDto.getAssertionConsumerServiceUri());
final String errorResponse = outboundResponseFromHubToResponseTransformerFactory.get(requestForErrorResponseFromHubDto.getAuthnRequestIssuerEntityId()).apply(response);
return new SamlMessageDto(errorResponse);
} catch (Exception e) {
throw new UnableToGenerateSamlException("Unable to generate RP error response", e, Level.ERROR);
}
}
use of uk.gov.ida.hub.samlengine.exceptions.UnableToGenerateSamlException in project verify-hub by alphagov.
the class AttributeQueryGenerator method newCreateAttributeQueryContainer.
public uk.gov.ida.hub.samlengine.contracts.AttributeQueryContainerDto newCreateAttributeQueryContainer(final T attributeQueryRequest, final URI msaUri, final String matchingServiceEntityId, final DateTime matchingServiceRequestTimeOut, boolean onboarding) {
try {
entityToEncryptForLocator.addEntityIdForRequestId(attributeQueryRequest.getId(), matchingServiceEntityId);
String samlRequest = XmlUtils.writeToString(attributeQueryRequestTransformer.apply(attributeQueryRequest));
return new uk.gov.ida.hub.samlengine.contracts.AttributeQueryContainerDto(attributeQueryRequest.getId(), attributeQueryRequest.getIssuer(), samlRequest, msaUri, matchingServiceRequestTimeOut, onboarding);
} catch (Exception e) {
throw new UnableToGenerateSamlException("failed to create attribute query request", e, Level.ERROR);
} finally {
entityToEncryptForLocator.removeEntityIdForRequestId(attributeQueryRequest.getId());
}
}
use of uk.gov.ida.hub.samlengine.exceptions.UnableToGenerateSamlException in project verify-hub by alphagov.
the class RpAuthnResponseGeneratorService method generate.
public AuthnResponseFromHubContainerDto generate(ResponseFromHubDto responseFromHub) {
String entityIdForEncryption = responseFromHub.getAuthnRequestIssuerEntityId();
String originalRequestId = responseFromHub.getInResponseTo();
try {
assignableEntityToEncryptForLocator.addEntityIdForRequestId(originalRequestId, entityIdForEncryption);
return createSuccessResponse(responseFromHub);
} catch (Exception e) {
throw new UnableToGenerateSamlException("Unable to generate RP authn response", e, Level.ERROR);
} finally {
assignableEntityToEncryptForLocator.removeEntityIdForRequestId(originalRequestId);
}
}
Aggregations