/** * 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 { RequestAbstractType req = (RequestAbstractType) samlObject; if (attribute.getLocalName().equals(RequestAbstractType.VERSION_ATTRIB_NAME)) { req.setVersion(SAMLVersion.valueOf(attribute.getValue())); } else if (attribute.getLocalName().equals(RequestAbstractType.ID_ATTRIB_NAME)) { req.setID(attribute.getValue()); attribute.getOwnerElement().setIdAttributeNode(attribute, true); } else if (attribute.getLocalName().equals(RequestAbstractType.ISSUE_INSTANT_ATTRIB_NAME) && !Strings.isNullOrEmpty(attribute.getValue())) { req.setIssueInstant(new DateTime(attribute.getValue(), ISOChronology.getInstanceUTC())); } else if (attribute.getLocalName().equals(RequestAbstractType.DESTINATION_ATTRIB_NAME)) { req.setDestination(attribute.getValue()); } else if (attribute.getLocalName().equals(RequestAbstractType.CONSENT_ATTRIB_NAME)) { req.setConsent(attribute.getValue()); } else { super.processAttribute(samlObject, attribute); } }