Search in sources :

Example 21 with Status

use of org.opensaml.saml.saml2.core.Status in project verify-hub by alphagov.

the class TransactionIdaStatusMarshallerTest method toSamlStatus_shouldTransformSuccess.

@Test
public void toSamlStatus_shouldTransformSuccess() {
    Status transformedStatus = marshaller.toSamlStatus(TransactionIdaStatus.Success);
    assertThat(transformedStatus.getStatusCode().getValue()).isEqualTo(StatusCode.SUCCESS);
}
Also used : Status(org.opensaml.saml.saml2.core.Status) TransactionIdaStatus(uk.gov.ida.saml.core.domain.TransactionIdaStatus) Test(org.junit.jupiter.api.Test)

Example 22 with Status

use of org.opensaml.saml.saml2.core.Status in project verify-hub by alphagov.

the class TransactionIdaStatusMarshallerTest method toSamlStatus_shouldTransformNoMatchingServiceMatchMayRetry.

@Test
public void toSamlStatus_shouldTransformNoMatchingServiceMatchMayRetry() {
    Status transformedStatus = marshaller.toSamlStatus(TransactionIdaStatus.NoMatchingServiceMatchFromHub);
    assertThat(transformedStatus.getStatusCode().getValue()).isEqualTo(StatusCode.SUCCESS);
    assertThat(transformedStatus.getStatusCode().getStatusCode()).isNotNull();
    assertThat(transformedStatus.getStatusCode().getStatusCode().getValue()).isEqualTo(SamlStatusCode.NO_MATCH);
}
Also used : Status(org.opensaml.saml.saml2.core.Status) TransactionIdaStatus(uk.gov.ida.saml.core.domain.TransactionIdaStatus) Test(org.junit.jupiter.api.Test)

Example 23 with Status

use of org.opensaml.saml.saml2.core.Status in project verify-hub by alphagov.

the class TransactionIdaStatusMarshallerTest method toSamlStatus_shouldTransformRequesterError.

@Test
public void toSamlStatus_shouldTransformRequesterError() {
    Status transformedStatus = marshaller.toSamlStatus(TransactionIdaStatus.RequesterError);
    assertThat(transformedStatus.getStatusCode().getValue()).isEqualTo(StatusCode.RESPONDER);
    assertThat(transformedStatus.getStatusCode().getStatusCode().getValue()).isEqualTo(StatusCode.REQUESTER);
}
Also used : Status(org.opensaml.saml.saml2.core.Status) TransactionIdaStatus(uk.gov.ida.saml.core.domain.TransactionIdaStatus) Test(org.junit.jupiter.api.Test)

Example 24 with Status

use of org.opensaml.saml.saml2.core.Status 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();
}
Also used : StatusCodeBuilder(uk.gov.ida.saml.core.test.builders.StatusCodeBuilder) StatusCode(org.opensaml.saml.saml2.core.StatusCode) StatusCodeBuilder.aStatusCode(uk.gov.ida.saml.core.test.builders.StatusCodeBuilder.aStatusCode)

Example 25 with Status

use of org.opensaml.saml.saml2.core.Status in project verify-hub by alphagov.

the class EncryptedResponseFromIdpValidatorTest method validateStatus_shouldNotErrorIfStatusIsResponderWithSubStatusNoAuthnContext.

@Test
public void validateStatus_shouldNotErrorIfStatusIsResponderWithSubStatusNoAuthnContext() throws Exception {
    Status status = createStatus(StatusCode.RESPONDER, createSubStatusCode(StatusCode.NO_AUTHN_CONTEXT));
    Response response = aResponse().withStatus(status).withNoDefaultAssertion().build();
    validator.validate(response);
}
Also used : ResponseValidatorTestHelper.createStatus(uk.gov.ida.saml.hub.validators.response.helpers.ResponseValidatorTestHelper.createStatus) Status(org.opensaml.saml.saml2.core.Status) IdpIdaStatus(uk.gov.ida.saml.hub.domain.IdpIdaStatus) Response(org.opensaml.saml.saml2.core.Response) ResponseBuilder.aResponse(uk.gov.ida.saml.core.test.builders.ResponseBuilder.aResponse) Test(org.junit.jupiter.api.Test)

Aggregations

Status (org.opensaml.saml.saml2.core.Status)103 Test (org.junit.jupiter.api.Test)83 Response (org.opensaml.saml.saml2.core.Response)59 StatusCode (org.opensaml.saml.saml2.core.StatusCode)33 IdpIdaStatus (uk.gov.ida.saml.hub.domain.IdpIdaStatus)33 ResponseBuilder.aResponse (uk.gov.ida.saml.core.test.builders.ResponseBuilder.aResponse)27 SamlAssertionWrapper (org.apache.wss4j.common.saml.SamlAssertionWrapper)22 SAMLCallback (org.apache.wss4j.common.saml.SAMLCallback)20 Document (org.w3c.dom.Document)20 TransactionIdaStatus (uk.gov.ida.saml.core.domain.TransactionIdaStatus)20 Element (org.w3c.dom.Element)19 StatusBuilder.aStatus (uk.gov.ida.saml.core.test.builders.StatusBuilder.aStatus)19 DateTime (org.joda.time.DateTime)17 WSSecurityException (org.apache.wss4j.common.ext.WSSecurityException)16 ResponseValidatorTestHelper.createStatus (uk.gov.ida.saml.hub.validators.response.helpers.ResponseValidatorTestHelper.createStatus)16 OpenSamlXmlObjectFactory (uk.gov.ida.saml.core.OpenSamlXmlObjectFactory)14 StatusCodeBuilder.aStatusCode (uk.gov.ida.saml.core.test.builders.StatusCodeBuilder.aStatusCode)14 Crypto (org.apache.wss4j.common.crypto.Crypto)9 SamlStatusCode (uk.gov.ida.saml.core.domain.SamlStatusCode)9 InputStream (java.io.InputStream)8