/** * Sets the destination attribute on an outbound message if it is either a * {@link org.opensaml.saml.saml2.core.RequestAbstractType} or a * {@link org.opensaml.saml.saml2.core.StatusResponseType} message. * * @param outboundMessage outbound SAML message * @param endpointURL destination endpoint */ public static void setSAML2Destination(@Nonnull final SAMLObject outboundMessage, @Nonnull @NotEmpty final String endpointURL) { if (outboundMessage instanceof org.opensaml.saml.saml2.core.RequestAbstractType) { ((org.opensaml.saml.saml2.core.RequestAbstractType) outboundMessage).setDestination(endpointURL); } else if (outboundMessage instanceof org.opensaml.saml.saml2.core.StatusResponseType) { ((org.opensaml.saml.saml2.core.StatusResponseType) outboundMessage).setDestination(endpointURL); } }
/** {@inheritDoc} */ protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException { StatusResponseType sr = (StatusResponseType) samlObject; if (attribute.getLocalName().equals(StatusResponseType.VERSION_ATTRIB_NAME)) { sr.setVersion(SAMLVersion.valueOf(attribute.getValue())); } else if (attribute.getLocalName().equals(StatusResponseType.ID_ATTRIB_NAME)) { sr.setID(attribute.getValue()); attribute.getOwnerElement().setIdAttributeNode(attribute, true); } else if (attribute.getLocalName().equals(StatusResponseType.IN_RESPONSE_TO_ATTRIB_NAME)) { sr.setInResponseTo(attribute.getValue()); } else if (attribute.getLocalName().equals(StatusResponseType.ISSUE_INSTANT_ATTRIB_NAME) && !Strings.isNullOrEmpty(attribute.getValue())) { sr.setIssueInstant(new DateTime(attribute.getValue(), ISOChronology.getInstanceUTC())); } else if (attribute.getLocalName().equals(StatusResponseType.DESTINATION_ATTRIB_NAME)) { sr.setDestination(attribute.getValue()); } else if (attribute.getLocalName().equals(StatusResponseType.CONSENT_ATTRIB_NAME)) { sr.setConsent(attribute.getValue()); } else { super.processAttribute(samlObject, attribute); } }