use of org.opensaml.saml.saml2.core.StatusCode in project verify-hub by alphagov.
the class IdpIdaStatusUnmarshallerTest method transform_shouldTransformNoAuthenticationContext.
@Test
public void transform_shouldTransformNoAuthenticationContext() {
OpenSamlXmlObjectFactory samlObjectFactory = new OpenSamlXmlObjectFactory();
Status originalStatus = samlObjectFactory.createStatus();
StatusCode topLevelStatusCode = samlObjectFactory.createStatusCode();
topLevelStatusCode.setValue(StatusCode.RESPONDER);
StatusCode subStatusCode = samlObjectFactory.createStatusCode();
subStatusCode.setValue(StatusCode.NO_AUTHN_CONTEXT);
topLevelStatusCode.setStatusCode(subStatusCode);
originalStatus.setStatusCode(topLevelStatusCode);
IdpIdaStatus transformedStatus = unmarshaller.fromSaml(originalStatus);
assertThat(transformedStatus).isEqualTo(IdpIdaStatus.noAuthenticationContext());
}
use of org.opensaml.saml.saml2.core.StatusCode in project verify-hub by alphagov.
the class IdpIdaStatusUnmarshallerTest method transform_shouldTransformRequesterErrorWithRequestDeniedSubstatus.
@Test
public void transform_shouldTransformRequesterErrorWithRequestDeniedSubstatus() {
OpenSamlXmlObjectFactory samlObjectFactory = new OpenSamlXmlObjectFactory();
Status status = samlObjectFactory.createStatus();
StatusCode topLevelStatusCode = samlObjectFactory.createStatusCode();
topLevelStatusCode.setValue(StatusCode.REQUESTER);
StatusCode subStatusCode = samlObjectFactory.createStatusCode();
subStatusCode.setValue(StatusCode.REQUEST_DENIED);
status.setStatusCode(topLevelStatusCode);
IdpIdaStatus transformedStatus = unmarshaller.fromSaml(status);
assertThat(transformedStatus).isEqualTo(IdpIdaStatus.requesterError());
}
use of org.opensaml.saml.saml2.core.StatusCode in project verify-hub by alphagov.
the class ResponseValidatorTestHelper method createStatus.
public static Status createStatus(String statusCodeValue, StatusCode subStatusCode) {
StatusCodeBuilder statusCodeBuilder = aStatusCode().withValue(statusCodeValue);
StatusCode statusCode = subStatusCode == null ? statusCodeBuilder.build() : statusCodeBuilder.withSubStatusCode(subStatusCode).build();
return aStatus().withStatusCode(statusCode).build();
}
use of org.opensaml.saml.saml2.core.StatusCode in project verify-hub by alphagov.
the class EncryptedResponseFromIdpValidatorTest method validateStatus_shouldThrowExceptionIfSuccessHasASubStatus.
@Test
public void validateStatus_shouldThrowExceptionIfSuccessHasASubStatus() throws Exception {
StatusCode subStatusCode = createSubStatusCode();
Status status = createStatus(StatusCode.SUCCESS, subStatusCode);
Response response = aResponse().withStatus(status).build();
assertValidationFailure(response, invalidSubStatusCode(subStatusCode.getValue(), StatusCode.SUCCESS));
}
use of org.opensaml.saml.saml2.core.StatusCode in project verify-hub by alphagov.
the class EncryptedResponseFromIdpValidatorTest method validateStatus_shouldThrowExceptionIfRequesterHasASubStatus.
@Test
public void validateStatus_shouldThrowExceptionIfRequesterHasASubStatus() throws Exception {
StatusCode subStatusCode = createSubStatusCode();
Status status = createStatus(StatusCode.REQUESTER, subStatusCode);
Response response = aResponse().withStatus(status).build();
assertValidationFailure(response, invalidSubStatusCode(subStatusCode.getValue(), StatusCode.REQUESTER));
}
Aggregations