use of uk.gov.ida.hub.samlengine.contracts.RequestForErrorResponseFromHubDto in project verify-hub by alphagov.
the class RpErrorResponseGeneratorResourceTest method shouldGenerateAnErrorResponseForAnRp.
@Test
public void shouldGenerateAnErrorResponseForAnRp() throws JsonProcessingException {
RequestForErrorResponseFromHubDto requestForErrorResponseFromHubDto = aRequestForErrorResponseFromHubDto().build();
configStub.signResponsesAndUseSamlStandard(requestForErrorResponseFromHubDto.getAuthnRequestIssuerEntityId());
final URI uri = samlEngineAppRule.getUri(Urls.SamlEngineUrls.GENERATE_RP_ERROR_RESPONSE_RESOURCE);
Response rpAuthnResponse = post(requestForErrorResponseFromHubDto, uri);
assertThat(rpAuthnResponse.getStatus()).isEqualTo(Response.Status.OK.getStatusCode());
SamlMessageDto samlMessageDto = rpAuthnResponse.readEntity(SamlMessageDto.class);
assertThat(samlMessageDto.getSamlMessage()).isNotNull();
}
use of uk.gov.ida.hub.samlengine.contracts.RequestForErrorResponseFromHubDto in project verify-hub by alphagov.
the class RpErrorResponseGeneratorResourceTest method shouldReturnAnErrorResponseGivenBadInput.
@Test
public void shouldReturnAnErrorResponseGivenBadInput() throws JsonProcessingException {
RequestForErrorResponseFromHubDto requestForErrorResponseFromHubDto = aRequestForErrorResponseFromHubDto().withStatus(null).build();
configStub.signResponsesAndUseSamlStandard(requestForErrorResponseFromHubDto.getAuthnRequestIssuerEntityId());
final URI uri = samlEngineAppRule.getUri(Urls.SamlEngineUrls.GENERATE_RP_ERROR_RESPONSE_RESOURCE);
Response rpAuthnResponse = post(requestForErrorResponseFromHubDto, uri);
assertThat(rpAuthnResponse.getStatus()).isEqualTo(Response.Status.BAD_REQUEST.getStatusCode());
ErrorStatusDto errorStatusDto = rpAuthnResponse.readEntity(ErrorStatusDto.class);
assertThat(errorStatusDto.getExceptionType()).isEqualTo(ExceptionType.INVALID_INPUT);
}
Aggregations