/** {@inheritDoc} */ protected void marshallAttributes(XMLObject samlElement, Element domElement) throws MarshallingException { StatusCode statusCode = (StatusCode) samlElement; QName statusValue = statusCode.getValue(); if (statusValue != null) { domElement.setAttributeNS(null, StatusCode.VALUE_ATTRIB_NAME, QNameSupport.qnameToContentString(statusValue)); } } }
/** {@inheritDoc} */ @Override @Nullable public String apply(@Nullable final ProfileRequestContext input) { final SAMLObject response = responseLookupStrategy.apply(input); if (response != null) { if (response instanceof Response) { final org.opensaml.saml.saml1.core.StatusCode sc = ((Response) response).getStatus() != null ? ((Response) response).getStatus().getStatusCode() : null; if (sc != null && sc.getValue() != null) { return sc.getValue().getLocalPart(); } } else if (response instanceof StatusResponseType) { final org.opensaml.saml.saml2.core.StatusCode sc = ((StatusResponseType) response).getStatus() != null ? ((StatusResponseType) response).getStatus().getStatusCode() : null; if (sc != null) { return sc.getValue(); } } } return null; }
/** * Get whether the message is a SAML response containing an error status. * * @param message message to check * * @return true iff the message is a SAML response containing an error status */ private boolean isErrorResponse(@Nullable final Object message) { if (message != null) { if (message instanceof Response) { if (((Response) message).getStatus() != null) { final org.opensaml.saml.saml1.core.StatusCode s1 = ((Response) message).getStatus().getStatusCode(); return s1 != null && s1.getValue() != null && !org.opensaml.saml.saml1.core.StatusCode.SUCCESS.equals(s1.getValue()); } } else if (message instanceof StatusResponseType) { if (((StatusResponseType) message).getStatus() != null) { final org.opensaml.saml.saml2.core.StatusCode s2 = ((StatusResponseType) message).getStatus().getStatusCode(); return s2 != null && s2.getValue() != null && !org.opensaml.saml.saml2.core.StatusCode.SUCCESS.equals(s2.getValue()); } } } return false; }
|| samlResponse.getStatus().getStatusCode().getValue() == null) { LOG.fine("Either the SAML Response Status or StatusCode is null"); throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "invalidSAMLsecurity"); String statusValue = samlResponse.getStatus().getStatusCode().getValue().getLocalPart(); if (!SAML1_STATUSCODE_SUCCESS.equals(statusValue)) { LOG.fine( "SAML Status code of " + samlResponse.getStatus().getStatusCode().getValue() + "does not equal " + SAML1_STATUSCODE_SUCCESS );