use of uk.gov.ida.saml.core.validation.errors.SamlValidationSpecification in project verify-hub by alphagov.
the class SamlMessageSenderHandlerTest method generateErrorResponseFromHub_shouldThrowSamlTransformationException.
@Test(expected = SamlTransformationErrorException.class)
public void generateErrorResponseFromHub_shouldThrowSamlTransformationException() throws MarshallingException, SignatureException {
SessionId sessionId = SessionId.createNewSessionId();
String expectedSamlMessageId = UUID.randomUUID().toString();
Response openSamlResponse = setUpErrorResponseFromHub(sessionId, expectedSamlMessageId);
when(samlMessageSignatureValidator.validate(openSamlResponse, SPSSODescriptor.DEFAULT_ELEMENT_NAME)).thenReturn(SamlValidationResponse.anInvalidResponse(new SamlValidationSpecification("bad", true)));
samlMessageSenderHandler.generateErrorResponseFromHub(sessionId, principalIpAddressAsSeenByHub);
}
use of uk.gov.ida.saml.core.validation.errors.SamlValidationSpecification in project verify-hub by alphagov.
the class SamlMessageSenderHandlerTest method generateAuthRequestFromHub_shouldThrowSamlTransformationException.
@Test(expected = SamlTransformationErrorException.class)
public void generateAuthRequestFromHub_shouldThrowSamlTransformationException() throws MarshallingException, SignatureException {
SessionId sessionId = SessionId.createNewSessionId();
String expectedSamlMessageId = UUID.randomUUID().toString();
when(sessionProxy.getAuthnRequestFromHub(sessionId)).thenReturn(new AuthnRequestFromHubContainerDto(samlRequest, postEndPoint, true));
AuthnRequest authnRequest = anAuthnRequest().withId(expectedSamlMessageId).build();
when(authnRequestTransformer.apply(samlRequest)).thenReturn(authnRequest);
when(samlMessageSignatureValidator.validate(authnRequest, SPSSODescriptor.DEFAULT_ELEMENT_NAME)).thenReturn(SamlValidationResponse.anInvalidResponse(new SamlValidationSpecification("bad", true)));
samlMessageSenderHandler.generateAuthnRequestFromHub(sessionId, principalIpAddressAsSeenByHub);
}
use of uk.gov.ida.saml.core.validation.errors.SamlValidationSpecification in project verify-hub by alphagov.
the class SamlMessageSenderHandlerTest method generateAuthResponseFromHub_shouldThrowSamlTransformationException.
@Test(expected = SamlTransformationErrorException.class)
public void generateAuthResponseFromHub_shouldThrowSamlTransformationException() throws MarshallingException, SignatureException {
SessionId sessionId = SessionId.createNewSessionId();
String expectedSamlMessageId = UUID.randomUUID().toString();
Response openSamlResponse = setUpAuthnResponseFromHub(sessionId, expectedSamlMessageId);
when(samlMessageSignatureValidator.validate(openSamlResponse, SPSSODescriptor.DEFAULT_ELEMENT_NAME)).thenReturn(SamlValidationResponse.anInvalidResponse(new SamlValidationSpecification("bad", true)));
samlMessageSenderHandler.generateAuthnResponseFromHub(sessionId, principalIpAddressAsSeenByHub);
}
Aggregations