public final class WSSecurityUtil extends Object
Modifier and Type | Method and Description |
---|---|
static Text |
createBase64EncodedTextNode(Document doc,
byte[] data)
create a base64 test node
|
static List<Integer> |
decodeAction(String action) |
static List<HandlerAction> |
decodeHandlerAction(String action,
WSSConfig wssConfig)
Decode an action String.
|
static Element |
findBodyElement(Document doc)
return the first soap "Body" element.
|
static List<Element> |
findElements(WSEncryptionPart part,
CallbackLookup callbackLookup,
Document doc)
Find the DOM Element in the SOAP Envelope that is referenced by the
WSEncryptionPart argument.
|
static Element |
findWsseSecurityHeaderBlock(Document doc,
Element envelope,
boolean doCreate)
find the first ws-security header block
|
static Element |
findWsseSecurityHeaderBlock(Document doc,
Element envelope,
String actor,
boolean doCreate)
find a WS-Security header block for a given actor
|
static byte[] |
generateNonce(int length)
Generate a nonce of the given length using the SHA1PRNG algorithm.
|
static byte[] |
getBytesFromAttachment(String xopUri,
RequestData data) |
static WSEncryptionPart |
getDefaultEncryptionPart(Document doc)
Get the default encryption part - the SOAP Body of type "Content".
|
static List<Element> |
getDirectChildElements(Node fNode,
String localName,
String namespace)
Gets all direct children with specified localname and namespace.
|
static Element |
getSecurityHeader(Document doc,
String actor)
Returns the first WS-Security header element for a given actor.
|
static Element |
getSecurityHeader(Element soapHeader,
String actor,
boolean soap12)
Returns the first WS-Security header element for a given actor.
|
static SOAPConstants |
getSOAPConstants(Element startElement) |
static Element |
getSOAPHeader(Document doc) |
static String |
getSOAPNamespace(Element startElement) |
static boolean |
isActorEqual(String actor,
String hActor)
Compares two actor strings and returns true if these are equal.
|
static Element |
prependChildElement(Element parent,
Element child)
prepend a child element
|
static void |
storeBytesInAttachment(Element parentElement,
Document doc,
String attachmentId,
byte[] bytes,
CallbackHandler attachmentCallbackHandler) |
static void |
verifySignedElement(Element elem,
List<WSSecurityEngineResult> signedResults) |
static void |
verifySignedElement(Element elem,
WSDocInfo wsDocInfo) |
public static Element getSecurityHeader(Document doc, String actor) throws WSSecurityException
doc
- actor
- wsse:Security
element or null
if not such element foundWSSecurityException
public static Element getSecurityHeader(Element soapHeader, String actor, boolean soap12) throws WSSecurityException
WSSecurityException
public static boolean isActorEqual(String actor, String hActor)
actor
- hActor
- public static List<Element> getDirectChildElements(Node fNode, String localName, String namespace)
fNode
- the node where to start the searchlocalName
- local name of the children to getnamespace
- the namespace of the children to getnull
if not such nodes are foundpublic static Element findBodyElement(Document doc)
doc
- null
if document does not
contain a SOAP bodypublic static List<Element> findElements(WSEncryptionPart part, CallbackLookup callbackLookup, Document doc) throws WSSecurityException
part
- The WSEncryptionPart object corresponding to the DOM Element(s) we wantcallbackLookup
- The CallbackLookup object used to find Elementsdoc
- The owning documentWSSecurityException
public static WSEncryptionPart getDefaultEncryptionPart(Document doc)
public static Element prependChildElement(Element parent, Element child)
parent
- element of this child elementchild
- the element to appendpublic static Element findWsseSecurityHeaderBlock(Document doc, Element envelope, boolean doCreate) throws WSSecurityException
doc
- the DOM document (SOAP request)envelope
- the SOAP envelopedoCreate
- if true create a new WSS header block if none existsWSSecurityException
public static Element findWsseSecurityHeaderBlock(Document doc, Element envelope, String actor, boolean doCreate) throws WSSecurityException
doc
- the DOM document (SOAP request)envelope
- the SOAP envelopeactor
- the actor (role) name of the WSS headerdoCreate
- if true create a new WSS header block if none existsWSSecurityException
public static Text createBase64EncodedTextNode(Document doc, byte[] data)
doc
- the DOM document (SOAP request)data
- to encodepublic static SOAPConstants getSOAPConstants(Element startElement)
public static List<Integer> decodeAction(String action) throws WSSecurityException
WSSecurityException
public static List<HandlerAction> decodeHandlerAction(String action, WSSConfig wssConfig) throws WSSecurityException
action
- The initial String of actions to performwssConfig
- This object holds the list of custom actions to be performed.WSSecurityException
public static byte[] generateNonce(int length) throws WSSecurityException
WSSecurityException
public static void verifySignedElement(Element elem, WSDocInfo wsDocInfo) throws WSSecurityException
WSSecurityException
public static void verifySignedElement(Element elem, List<WSSecurityEngineResult> signedResults) throws WSSecurityException
WSSecurityException
public static byte[] getBytesFromAttachment(String xopUri, RequestData data) throws WSSecurityException
WSSecurityException
public static void storeBytesInAttachment(Element parentElement, Document doc, String attachmentId, byte[] bytes, CallbackHandler attachmentCallbackHandler) throws WSSecurityException
WSSecurityException
Copyright © 2016 JBoss by Red Hat. All rights reserved.