Search in sources :

Example 41 with StatusCode

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

the class ProtectiveMonitoringLogger method logAuthnResponse.

public void logAuthnResponse(Response samlResponse, Direction direction, SignatureStatus signatureStatus) {
    Map<String, String> copyOfContextMap = Optional.ofNullable(MDC.getCopyOfContextMap()).orElse(Collections.emptyMap());
    StatusCode statusCode = samlResponse.getStatus().getStatusCode();
    MDC.setContextMap(Map.of("responseId", samlResponse.getID(), "inResponseTo", samlResponse.getInResponseTo(), "status", statusCode.getValue(), "subStatus", Optional.ofNullable(statusCode.getStatusCode()).map(StatusCode::getValue).orElse("NoSubStatus"), "direction", direction.name(), "issuerId", Optional.ofNullable(samlResponse.getIssuer()).map(Issuer::getValue).orElse("NoIssuer"), "destination", Optional.ofNullable(samlResponse.getDestination()).orElse("NoDestination"), "signatureStatus", signatureStatus.name()));
    LOG.info(formatter.formatAuthnResponse(samlResponse, direction, signatureStatus));
    MDC.clear();
    MDC.setContextMap(copyOfContextMap);
}
Also used : StatusCode(org.opensaml.saml.saml2.core.StatusCode)

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