use of uk.gov.ida.hub.samlengine.contracts.MatchingServiceHealthCheckerResponseDto in project verify-hub by alphagov.
the class MatchingServiceHealthcheckResponseTranslatorService method translate.
public MatchingServiceHealthCheckerResponseDto translate(SamlMessageDto samlMessageDto) {
Response response = responseUnmarshaller.apply(samlMessageDto.getSamlMessage());
MdcHelper.addContextToMdc(response);
final InboundHealthCheckResponseFromMatchingService responseFromMatchingService = samlResponseToInboundHealthCheckResponseFromMatchingServiceTransformer.transform(response);
final MatchingServiceHealthCheckerResponseDto matchingServiceHealthCheckerResponseDto = new MatchingServiceHealthCheckerResponseDto(responseFromMatchingService.getStatus(), responseFromMatchingService.getInResponseTo(), responseFromMatchingService.getIssuer(), responseFromMatchingService.getId());
return matchingServiceHealthCheckerResponseDto;
}
use of uk.gov.ida.hub.samlengine.contracts.MatchingServiceHealthCheckerResponseDto in project verify-hub by alphagov.
the class MatchingServiceHealthcheckResponseTranslatorResourceTest method should_translateHealthcheckAttributeQueryResponse.
@Test
public void should_translateHealthcheckAttributeQueryResponse() throws Exception {
final String msaStatusCode = SamlStatusCode.HEALTHY;
final Status status = aStatus().withStatusCode(aStatusCode().withSubStatusCode(aStatusCode().withValue(msaStatusCode).build()).withValue(StatusCode.SUCCESS).build()).build();
final String requestId = "requestId";
final String saml = aValidMatchResponseFromMatchingService(requestId, status, DateTime.now().plusHours(1));
Response response = postResponseForTranslation(new SamlMessageDto(Base64.encodeAsString(saml)));
MatchingServiceHealthCheckerResponseDto entity = response.readEntity(MatchingServiceHealthCheckerResponseDto.class);
assertThat(response.getStatus()).isEqualTo(Response.Status.OK.getStatusCode());
assertThat(entity.getStatus()).isEqualTo(MatchingServiceIdaStatus.Healthy);
assertThat(entity.getInResponseTo()).isEqualTo(requestId);
assertThat(entity.getIssuer()).isEqualTo(TEST_RP_MS);
}
Aggregations