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: empty actor and mustunderstand is true.
  • Constructor Details

    • 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 the wsse:Security header
      doc - The Document to use when creating the security header
    • WSSecHeader

      public WSSecHeader(String act, boolean mu, Document doc)
      Constructor.
      Parameters:
      act - The actor name of the wsse:Security header
      mu - Set mustUnderstand to true or false
      doc - The Document to use when creating the security header
  • Method Details

    • setActor

      public void setActor(String act)
      set actor name.
      Parameters:
      act - The actor name of the wsse:Security header
    • setMustUnderstand

      public void setMustUnderstand(boolean mu)
      Set the mustUnderstand flag for the wsse:Security header.
      Parameters:
      mu - Set mustUnderstand to 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 WSSecurityException
      Returns 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:Security element
      Throws:
      WSSecurityException
    • removeSecurityHeader

      public void removeSecurityHeader() throws WSSecurityException
      Throws:
      WSSecurityException
    • getWsuPrefix

      public String getWsuPrefix()