Search in sources :

Example 1 with StatusValue

use of uk.gov.ida.saml.core.extensions.StatusValue 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 2 with StatusValue

use of uk.gov.ida.saml.core.extensions.StatusValue in project verify-hub by alphagov.

the class IdpIdaStatusMarshaller method getStatusDetail.

@Override
protected Optional<StatusDetail> getStatusDetail(IdpIdaStatus originalStatus) {
    if (REST_TO_STATUS_DETAIL.containsKey(originalStatus)) {
        StatusDetail statusDetail = this.samlObjectFactory.createStatusDetail();
        StatusValue statusValue = this.samlObjectFactory.createStatusValue(REST_TO_STATUS_DETAIL.get(originalStatus));
        statusDetail.getUnknownXMLObjects().add(statusValue);
        return of(statusDetail);
    }
    return empty();
}
Also used : StatusDetail(org.opensaml.saml.saml2.core.StatusDetail) StatusValue(uk.gov.ida.saml.core.extensions.StatusValue)

Example 3 with StatusValue

use of uk.gov.ida.saml.core.extensions.StatusValue in project verify-hub by alphagov.

the class IdpIdaStatusMarshallerTest method shouldMarshallStatusDetailWithStatusValueContainingAuthnCancelInCaseOfAuthenticationCancelled.

@Test
public void shouldMarshallStatusDetailWithStatusValueContainingAuthnCancelInCaseOfAuthenticationCancelled() {
    Status status = marshaller.toSamlStatus(IdpIdaStatus.authenticationCancelled());
    StatusValue actual = (StatusValue) status.getStatusDetail().getOrderedChildren().get(0);
    assertThat(actual.getNamespaces()).isEmpty();
    assertThat(actual.getValue()).isEqualTo(StatusValue.CANCEL);
}
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 4 with StatusValue

use of uk.gov.ida.saml.core.extensions.StatusValue in project verify-hub by alphagov.

the class IdpIdaStatusMarshallerTest method transform_shouldTransformAuthenticationPending.

@Test
public void transform_shouldTransformAuthenticationPending() {
    Status transformedStatus = marshaller.toSamlStatus(IdpIdaStatus.authenticationPending());
    StatusValue actual = (StatusValue) transformedStatus.getStatusDetail().getOrderedChildren().get(0);
    assertThat(transformedStatus.getStatusCode().getValue()).isEqualTo(StatusCode.RESPONDER);
    assertThat(transformedStatus.getStatusCode().getStatusCode().getValue()).isEqualTo(StatusCode.NO_AUTHN_CONTEXT);
    assertThat(actual.getValue()).isEqualTo(StatusValue.PENDING);
}
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)

Aggregations

StatusValue (uk.gov.ida.saml.core.extensions.StatusValue)4 Test (org.junit.jupiter.api.Test)3 Status (org.opensaml.saml.saml2.core.Status)3 IdpIdaStatus (uk.gov.ida.saml.hub.domain.IdpIdaStatus)3 StatusDetail (org.opensaml.saml.saml2.core.StatusDetail)1