/** {@inheritDoc} */ public List<XMLObject> getOrderedChildren() { LazyList<XMLObject> children = new LazyList<>(); if (encryptedData != null) { children.add(encryptedData); } return Collections.unmodifiableList(children); }
/** * Resolve the SAML 2.0 Assertions token from the SOAP envelope. * * @param messageContext the current message context * * @return the list of resolved Assertions, or an empty list */ @Nonnull protected List<Assertion> resolveAssertions(@Nonnull final MessageContext messageContext) { List<XMLObject> securityHeaders = SOAPMessagingSupport.getInboundHeaderBlock(messageContext, Security.ELEMENT_NAME); if (securityHeaders == null || securityHeaders.isEmpty()) { log.debug("No WS-Security Security header found in inbound SOAP message. Skipping further processing."); return Collections.emptyList(); } LazyList<Assertion> assertions = new LazyList<>(); // There could be multiple Security headers targeted to this node, so process all of them for (XMLObject header : securityHeaders) { Security securityHeader = (Security) header; List<XMLObject> xmlObjects = securityHeader.getUnknownXMLObjects(Assertion.DEFAULT_ELEMENT_NAME); if (xmlObjects != null && !xmlObjects.isEmpty()) { for (XMLObject xmlObject : xmlObjects) { assertions.add((Assertion) xmlObject); } } } return assertions; }
/** * Get a header block from the SOAP 1.1 envelope. * * @param envelope the SOAP 1.1 envelope to process * @param headerName the name of the header block to return * @param targetNodes the explicitly specified SOAP node actors for which the header is desired * @param isFinalDestination true specifies that headers targeted for message final destination should be returned, * false specifies they should not be returned * @return the list of matching header blocks */ @Nonnull public static List<XMLObject> getSOAP11HeaderBlock(@Nonnull final Envelope envelope, @Nonnull final QName headerName, @Nullable final Set<String> targetNodes, boolean isFinalDestination) { Constraint.isNotNull(envelope, "Envelope cannot be null"); Constraint.isNotNull(headerName, "Header name cannot be null"); Header envelopeHeader = envelope.getHeader(); if (envelopeHeader == null) { return Collections.emptyList(); } LazyList<XMLObject> headers = new LazyList<>(); for (XMLObject header : envelopeHeader.getUnknownXMLObjects(headerName)) { if (isSOAP11HeaderTargetedToNode(header, targetNodes, isFinalDestination)) { headers.add(header); } } return headers; }