Package org.apache.wss4j.dom.message
Class WSSecHeader
- java.lang.Object
-
- org.apache.wss4j.dom.message.WSSecHeader
-
public class WSSecHeader extends Object
This class implements WS Security header. Setup a Security header with a specified actor and mustunderstand flag. The defaults for actor and mustunderstand are: emptyactorandmustunderstandis true.
-
-
Constructor Summary
Constructors Constructor Description WSSecHeader(String act, boolean mu, Document doc)Constructor.WSSecHeader(String actor, Document doc)Constructor.WSSecHeader(Document doc)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DocumentgetSecurityHeaderDoc()Get the security header document of this instance.ElementgetSecurityHeaderElement()Get the security header element of this instance.StringgetWsuPrefix()ElementinsertSecurityHeader()Creates a security header and inserts it as child into the SOAP Envelope.booleanisEmpty()Returns whether the security header is emptyvoidremoveSecurityHeader()voidsetActor(String act)set actor name.voidsetMustUnderstand(boolean mu)Set themustUnderstandflag for thewsse:Securityheader.voidsetSecurityHeaderElement(Element securityHeaderElement)
-
-
-
Constructor Detail
-
WSSecHeader
public WSSecHeader(Document doc)
Constructor.- Parameters:
doc- The Document to use when creating the security header
-
WSSecHeader
public WSSecHeader(String actor, Document doc)
Constructor.- Parameters:
actor- The actor name of thewsse:Securityheaderdoc- The Document to use when creating the security header
-
-
Method Detail
-
setActor
public void setActor(String act)
set actor name.- Parameters:
act- The actor name of thewsse:Securityheader
-
setMustUnderstand
public void setMustUnderstand(boolean mu)
Set themustUnderstandflag for thewsse:Securityheader.- Parameters:
mu- SetmustUnderstandto true or false
-
getSecurityHeaderDoc
public Document getSecurityHeaderDoc()
Get the security header document of this instance.- Returns:
- The security header element.
-
getSecurityHeaderElement
public Element getSecurityHeaderElement()
Get the security header element of this instance.- Returns:
- The security header element.
-
setSecurityHeaderElement
public void setSecurityHeaderElement(Element securityHeaderElement)
-
isEmpty
public boolean isEmpty() throws WSSecurityExceptionReturns whether the security header is empty- Returns:
- true if empty or if there is no security header false if non empty security header
- Throws:
WSSecurityException
-
insertSecurityHeader
public Element insertSecurityHeader() throws WSSecurityException
Creates a security header and inserts it as child into the SOAP Envelope. Check if a WS Security header block for an actor is already available in the document. If a header block is found return it, otherwise a new wsse:Security header block is created and the attributes set- Returns:
- A
wsse:Securityelement - Throws:
WSSecurityException
-
removeSecurityHeader
public void removeSecurityHeader() throws WSSecurityException- Throws:
WSSecurityException
-
getWsuPrefix
public String getWsuPrefix()
-
-