Search in sources :

Example 16 with StatusCode

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

the class StatusMessageBuilder method build.

public StatusMessage build() {
    StatusMessage statusCode = openSamlXmlObjectFactory.createStatusMessage();
    statusCode.setMessage(message);
    return statusCode;
}
Also used : StatusMessage(org.opensaml.saml.saml2.core.StatusMessage)

Example 17 with StatusCode

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

the class ProtectiveMonitoringLogFormatter method formatAuthnResponse.

public String formatAuthnResponse(Response samlResponse, Direction direction, SignatureStatus signatureStatus) {
    Issuer issuer = samlResponse.getIssuer();
    String issuerString = issuer != null ? issuer.getValue() : "";
    Status status = samlResponse.getStatus();
    StatusCode subStatusCode = status.getStatusCode().getStatusCode();
    String subStatus = subStatusCode != null ? subStatusCode.getValue() : "";
    return String.format(AUTHN_RESPONSE, samlResponse.getID(), samlResponse.getInResponseTo(), direction, samlResponse.getDestination(), issuerString, signatureStatus.valid(), status.getStatusCode().getValue(), subStatus, getStatusDetailValues(status));
}
Also used : SignatureStatus(uk.gov.ida.hub.samlproxy.repositories.SignatureStatus) Status(org.opensaml.saml.saml2.core.Status) Issuer(org.opensaml.saml.saml2.core.Issuer) StatusCode(org.opensaml.saml.saml2.core.StatusCode)

Example 18 with StatusCode

use of org.opensaml.saml.saml2.core.StatusCode in project ddf by codice.

the class SamlProtocol method createStatus.

public static Status createStatus(String statusValue) {
    Status status = statusBuilder.buildObject();
    StatusCode statusCode = statusCodeBuilder.buildObject();
    statusCode.setValue(statusValue);
    status.setStatusCode(statusCode);
    return status;
}
Also used : Status(org.opensaml.saml.saml2.core.Status) StatusCode(org.opensaml.saml.saml2.core.StatusCode)

Example 19 with StatusCode

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

the class ProtectiveMonitoringLogFormatter method formatAuthnResponse.

public String formatAuthnResponse(Response samlResponse, Direction direction, Boolean validSignature) {
    Issuer issuer = samlResponse.getIssuer();
    String issuerString = issuer != null ? issuer.getValue() : "";
    Status status = samlResponse.getStatus();
    StatusCode subStatusCode = status.getStatusCode().getStatusCode();
    String subStatus = subStatusCode != null ? subStatusCode.getValue() : "";
    return String.format(AUTHN_RESPONSE, samlResponse.getID(), samlResponse.getInResponseTo(), direction, samlResponse.getDestination(), issuerString, validSignature, status.getStatusCode().getValue(), subStatus, getStatusDetailValues(status));
}
Also used : Status(org.opensaml.saml.saml2.core.Status) Issuer(org.opensaml.saml.saml2.core.Issuer) StatusCode(org.opensaml.saml.saml2.core.StatusCode)

Example 20 with StatusCode

use of org.opensaml.saml.saml2.core.StatusCode in project cxf by apache.

the class SAML2PResponseComponentBuilder method createStatus.

@SuppressWarnings("unchecked")
public static Status createStatus(String statusCodeValue, String statusMessage) {
    if (statusBuilder == null) {
        statusBuilder = (SAMLObjectBuilder<Status>) builderFactory.getBuilder(Status.DEFAULT_ELEMENT_NAME);
    }
    if (statusCodeBuilder == null) {
        statusCodeBuilder = (SAMLObjectBuilder<StatusCode>) builderFactory.getBuilder(StatusCode.DEFAULT_ELEMENT_NAME);
    }
    if (statusMessageBuilder == null) {
        statusMessageBuilder = (SAMLObjectBuilder<StatusMessage>) builderFactory.getBuilder(StatusMessage.DEFAULT_ELEMENT_NAME);
    }
    Status status = statusBuilder.buildObject();
    StatusCode statusCode = statusCodeBuilder.buildObject();
    statusCode.setValue(statusCodeValue);
    status.setStatusCode(statusCode);
    if (statusMessage != null) {
        StatusMessage statusMessageObject = statusMessageBuilder.buildObject();
        statusMessageObject.setMessage(statusMessage);
        status.setStatusMessage(statusMessageObject);
    }
    return status;
}
Also used : Status(org.opensaml.saml.saml2.core.Status) StatusCode(org.opensaml.saml.saml2.core.StatusCode) StatusMessage(org.opensaml.saml.saml2.core.StatusMessage)

Aggregations

StatusCode (org.opensaml.saml.saml2.core.StatusCode)36 Status (org.opensaml.saml.saml2.core.Status)30 Test (org.junit.jupiter.api.Test)18 OpenSamlXmlObjectFactory (uk.gov.ida.saml.core.OpenSamlXmlObjectFactory)14 StatusCodeBuilder.aStatusCode (uk.gov.ida.saml.core.test.builders.StatusCodeBuilder.aStatusCode)14 SamlStatusCode (uk.gov.ida.saml.core.domain.SamlStatusCode)11 StatusBuilder.aStatus (uk.gov.ida.saml.core.test.builders.StatusBuilder.aStatus)10 IdpIdaStatus (uk.gov.ida.saml.hub.domain.IdpIdaStatus)9 StatusMessage (org.opensaml.saml.saml2.core.StatusMessage)6 SamlTransformationErrorFactory.invalidStatusCode (uk.gov.ida.saml.core.errors.SamlTransformationErrorFactory.invalidStatusCode)5 SamlTransformationErrorFactory.invalidSubStatusCode (uk.gov.ida.saml.core.errors.SamlTransformationErrorFactory.invalidSubStatusCode)5 Issuer (org.opensaml.saml.saml2.core.Issuer)4 StatusBuilder (org.opensaml.saml.saml2.core.impl.StatusBuilder)4 StatusCodeBuilder (org.opensaml.saml.saml2.core.impl.StatusCodeBuilder)4 TransactionIdaStatus (uk.gov.ida.saml.core.domain.TransactionIdaStatus)4 LogoutResponse (org.opensaml.saml.saml2.core.LogoutResponse)3 SamlValidationException (uk.gov.ida.saml.hub.exception.SamlValidationException)3 XMLObject (org.opensaml.core.xml.XMLObject)2 Response (org.opensaml.saml.saml2.core.Response)2 IssuerBuilder (org.opensaml.saml.saml2.core.impl.IssuerBuilder)2