/** * Get the SOAP Body */ public Element getSOAPBody() { return WSSecurityUtil.findBodyElement(doc); } }
public static byte[] getBytesFromAttachment( String xopUri, CallbackHandler attachmentCallbackHandler ) throws WSSecurityException { return getBytesFromAttachment(xopUri, attachmentCallbackHandler, true); }
public void setSecurityTokenReference(Element elem) { elementSecurityTokenReference = elem; WSSecurityUtil.prependChildElement(element, elem); }
public String getUsernameFromMessage(SOAPMessage saajSoapMessage) throws WSSecurityException { if (saajSoapMessage == null) { return null; } Element securityHeader = WSSecurityUtil.getSecurityHeader(saajSoapMessage.getSOAPPart(), ""); return getUsernameFromSecurityHeader(securityHeader); }
/** Sets the validation actions to be executed by the interceptor. */ public void setValidationActions(String actions) { this.validationActions = actions; try { validationActionsVector = WSSecurityUtil.decodeAction(actions); } catch (WSSecurityException ex) { throw new IllegalArgumentException(ex); } }
private static String getXOPURIFromEncryptedData(Element encData) { Element cipherValue = getCipherValueFromEncryptedData(encData); if (cipherValue != null) { return getXOPURIFromCipherValue(cipherValue); } return null; }
/** * find the first ws-security header block <p/> * * @param doc the DOM document (SOAP request) * @param envelope the SOAP envelope * @param doCreate if true create a new WSS header block if none exists * @return the WSS header or null if none found and doCreate is false */ public static Element findWsseSecurityHeaderBlock( Document doc, Element envelope, boolean doCreate ) throws WSSecurityException { return findWsseSecurityHeaderBlock(doc, envelope, null, doCreate); }
public static String getSOAPNamespace(Element startElement) { return getSOAPConstants(startElement).getEnvelopeURI(); }
/** * Get the List of inclusive prefixes from the DOM Element argument */ public List<String> getInclusivePrefixes(Element target, boolean excludeVisible) { return SignatureUtils.getInclusivePrefixes(target, excludeVisible); }
/** * Decrypt the EncryptedData argument using a SecretKey. * @param doc The (document) owner of EncryptedData * @param dataRefURI The URI of EncryptedData * @param encData The EncryptedData element * @param symmetricKey The SecretKey with which to decrypt EncryptedData * @param symEncAlgo The symmetric encryption algorithm to use * @param attachmentCallbackHandler The CallbackHandler from which to get attachments * @throws WSSecurityException */ public static WSDataRef decryptEncryptedData( Document doc, String dataRefURI, Element encData, SecretKey symmetricKey, String symEncAlgo, CallbackHandler attachmentCallbackHandler ) throws WSSecurityException { return decryptEncryptedData(doc, dataRefURI, encData, symmetricKey, symEncAlgo, attachmentCallbackHandler, null); } /**
public static void verifySignedElement(Element elem, WSDocInfo wsDocInfo) throws WSSecurityException { verifySignedElement(elem, wsDocInfo.getResultsByTag(WSConstants.SIGN)); }
public static byte[] getPSource(Node encBodyData) throws WSSecurityException { Element tmpE = XMLUtils.getDirectChildElement( encBodyData, "EncryptionMethod", WSConstants.ENC_NS ); if (tmpE != null) { Element pSourceElement = XMLUtils.getDirectChildElement(tmpE, "OAEPparams", WSConstants.ENC_NS); if (pSourceElement != null) { return getDecodedBase64EncodedData(pSourceElement); } } return null; }
public Element encrypt() throws WSSecurityException { if (getParts().isEmpty()) { getParts().add(WSSecurityUtil.getDefaultEncryptionPart(getDocument())); } return encryptForExternalRef(null, getParts()); }
/** * Get the SOAP Body */ @Override public Element getSOAPBody() { soapBody = (Element)DOMUtils.getDomElement(soapBody); if (soapBody != null) { return soapBody; } return WSSecurityUtil.findBodyElement(doc); } }
/** Sets the validation actions to be executed by the interceptor. */ public void setValidationActions(String actions) { this.validationActions = actions; try { validationActionsVector = WSSecurityUtil.decodeAction(actions); } catch (WSSecurityException ex) { throw new IllegalArgumentException(ex); } }
/** * Sets the security token reference of the derived key token * This is the reference to the shared secret used in the conversation/context * * @param ref Security token reference */ public void setSecurityTokenReference(SecurityTokenReference ref) { elementSecurityTokenReference = ref.getElement(); WSSecurityUtil.prependChildElement(element, ref.getElement()); }
public static byte[] getBytesFromAttachment( String xopUri, RequestData data ) throws WSSecurityException { return getBytesFromAttachment(xopUri, data.getAttachmentCallbackHandler()); }
/** * Get the SOAP Body */ @Override public Element getSOAPBody() { soapBody = (Element)DOMUtils.getDomElement(soapBody); if (soapBody != null) { return soapBody; } return WSSecurityUtil.findBodyElement(doc); } }
/** Sets the validation actions to be executed by the interceptor. */ public void setValidationActions(String actions) { this.validationActions = actions; try { validationActionsVector = WSSecurityUtil.decodeAction(actions); } catch (WSSecurityException ex) { throw new IllegalArgumentException(ex); } }
/** * Prepend the EncryptedKey element to the elements already in the Security * header. * * The method can be called any time after <code>prepare()</code>. This * allows to insert the EncryptedKey element at any position in the Security * header. */ public void prependToHeader() { Element secHeaderElement = getSecurityHeader().getSecurityHeaderElement(); WSSecurityUtil.prependChildElement(secHeaderElement, encryptedKeyElement); }