/** * Adds a new <code>SAMLAssertion</code> to a soap envelope. * <p/> * A complete <code>SAMLAssertion</code> is added to the * <code>wsse:Security</code> header. * * @param doc The SOAP envelope as W3C document * @param assertion TODO * @return Document with UsernameToken added */ public Document build(Document doc, AssertionWrapper assertion, WSSecHeader secHeader) { log.debug("Begin add SAMLAssertion token..."); prepare(doc, assertion); prependToHeader(secHeader); return doc; } }
public void execute(WSHandler handler, int actionToDo, Document doc, RequestData reqData) throws WSSecurityException { WSSecSAMLToken builder = new WSSecSAMLToken(reqData.getWssConfig()); SAMLIssuer saml = loadSamlIssuer(handler, reqData); AssertionWrapper assertion = saml.newAssertion(); // add the SAMLAssertion Token to the SOAP Envelope builder.build(doc, assertion, reqData.getSecHeader()); } }
/** * Prepends the SAML Assertion to the elements already in the * Security header. * * The method can be called any time after <code>prepare()</code>. * This allows to insert the SAML assertion at any position in the * Security header. * * @param secHeader * The security header that holds the Signature element. */ public void prependToHeader(WSSecHeader secHeader) { try { Element element = getElement(); if (element != null) { WSSecurityUtil.prependChildElement(secHeader.getSecurityHeader(), element); } } catch (WSSecurityException ex) { throw new RuntimeException(ex.toString(), ex); } }
public void execute(WSHandler handler, int actionToDo, Document doc, RequestData reqData) throws WSSecurityException { WSSecSAMLToken builder = new WSSecSAMLToken(reqData.getWssConfig()); SAMLIssuer saml = loadSamlIssuer(handler, reqData); AssertionWrapper assertion = saml.newAssertion(); // add the SAMLAssertion Token to the SOAP Envelope builder.build(doc, assertion, reqData.getSecHeader()); } }
/** * Prepends the SAML Assertion to the elements already in the * Security header. * * The method can be called any time after <code>prepare()</code>. * This allows to insert the SAML assertion at any position in the * Security header. * * @param secHeader * The security header that holds the Signature element. */ public void prependToHeader(WSSecHeader secHeader) { try { Element element = getElement(); if (element != null) { WSSecurityUtil.prependChildElement(secHeader.getSecurityHeader(), element); } } catch (WSSecurityException ex) { throw new RuntimeException(ex.toString(), ex); } }
/** * Adds a new <code>SAMLAssertion</code> to a soap envelope. * <p/> * A complete <code>SAMLAssertion</code> is added to the * <code>wsse:Security</code> header. * * @param doc The SOAP envelope as W3C document * @param assertion TODO * @return Document with UsernameToken added */ public Document build(Document doc, AssertionWrapper assertion, WSSecHeader secHeader) { log.debug("Begin add SAMLAssertion token..."); prepare(doc, assertion); prependToHeader(secHeader); return doc; } }