use of uk.gov.ida.hub.samlengine.contracts.SamlRequestWithAuthnRequestInformationDto in project verify-hub by alphagov.
the class RpAuthnRequestTranslatorResourceTest method shouldThrowExceptionWhenTheRequestIdIsADuplicate.
@Test
public void shouldThrowExceptionWhenTheRequestIdIsADuplicate() throws Exception {
SamlRequestWithAuthnRequestInformationDto requestDto = aSamlAuthnRequest().withId("_iamtheoneandonlytheresnootherrequestididratherbe").withIssuer(TEST_RP).withPublicCert(TEST_RP_PUBLIC_SIGNING_CERT).withPrivateKey(TEST_RP_PRIVATE_SIGNING_KEY).build();
post(requestDto, samlEngineAppRule.getUri(Urls.SamlEngineUrls.TRANSLATE_RP_AUTHN_REQUEST_RESOURCE));
Response response = post(requestDto, samlEngineAppRule.getUri(Urls.SamlEngineUrls.TRANSLATE_RP_AUTHN_REQUEST_RESOURCE));
assertThat(response.getStatus()).isEqualTo(Response.Status.BAD_REQUEST.getStatusCode());
ErrorStatusDto entity = response.readEntity(ErrorStatusDto.class);
assertThat(entity.getExceptionType()).isEqualTo(ExceptionType.INVALID_SAML_DUPLICATE_REQUEST_ID);
}
Aggregations