Search in sources :

Example 41 with Status

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

the class IdpIdaStatusMarshallerTest method shouldMarshallStatusDetailWithStatusValueContainingUpliftFailed.

@Test
public void shouldMarshallStatusDetailWithStatusValueContainingUpliftFailed() {
    Status status = marshaller.toSamlStatus(IdpIdaStatus.upliftFailed());
    StatusValue actual = (StatusValue) status.getStatusDetail().getOrderedChildren().get(0);
    assertThat(actual.getNamespaces()).isEmpty();
    assertThat(actual.getValue()).isEqualTo(StatusValue.UPLIFT_FAILED);
}
Also used : Status(org.opensaml.saml.saml2.core.Status) IdpIdaStatus(uk.gov.ida.saml.hub.domain.IdpIdaStatus) StatusValue(uk.gov.ida.saml.core.extensions.StatusValue) Test(org.junit.jupiter.api.Test)

Example 42 with Status

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

the class MatchingServiceIdaStatusToSamlStatusMarshallerTest method toSamlStatus_shouldTransformRequesterError.

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

Example 43 with Status

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

the class MatchingServiceIdaStatusToSamlStatusMarshallerTest method toSamlStatus_shouldTransformMatchingServiceMatch.

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

Example 44 with Status

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

the class MatchingServiceIdaStatusToSamlStatusMarshallerTest method toSamlStatus_shouldTransformNoMatchingServiceMatch.

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

Example 45 with Status

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

the class SamlProfileTransactionIdaStatusMarshallerTest method toSamlStatus_shouldTransformNoMatchingServiceMatchMayRetry.

@Test
public void toSamlStatus_shouldTransformNoMatchingServiceMatchMayRetry() {
    Status transformedStatus = marshaller.toSamlStatus(TransactionIdaStatus.NoMatchingServiceMatchFromHub);
    assertThat(transformedStatus.getStatusCode().getValue()).isEqualTo(StatusCode.RESPONDER);
    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)

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