Class WSSecBase

java.lang.Object
org.apache.wss4j.dom.message.WSSecBase
Direct Known Subclasses:
WSSecEncryptedKey, WSSecSAMLToken, WSSecSignatureBase, WSSecSignatureConfirmation, WSSecTimestamp, WSSecUsernameToken

public class WSSecBase extends Object
This is the base class for WS Security messages. It provides common functions and fields used by the specific message classes such as sign, encrypt, and username token.
  • Field Details

    • user

      protected String user
    • password

      protected String password
    • keyIdentifierType

      protected int keyIdentifierType
    • callbackLookup

      protected CallbackLookup callbackLookup
    • attachmentCallbackHandler

      protected CallbackHandler attachmentCallbackHandler
    • storeBytesInAttachment

      protected boolean storeBytesInAttachment
    • expandXopInclude

      protected boolean expandXopInclude
    • addWSUNamespace

      protected boolean addWSUNamespace
  • Constructor Details

    • WSSecBase

      public WSSecBase(WSSecHeader securityHeader)
    • WSSecBase

      public WSSecBase(Document doc)
  • Method Details

    • getDocument

      protected Document getDocument()
    • getSecurityHeader

      public WSSecHeader getSecurityHeader()
    • setCallbackLookup

      public void setCallbackLookup(CallbackLookup callbackLookup)
      Parameters:
      callbackLookup - The CallbackLookup object to retrieve elements
    • getParts

      public List<org.apache.wss4j.common.WSEncryptionPart> getParts()
      Get which parts of the message to encrypt/sign.
    • setKeyIdentifierType

      public void setKeyIdentifierType(int keyIdType)
      Sets which key identifier to use.

      Defines the key identifier type to use in the method or the method function to set up the key identification elements.

      Parameters:
      keyIdType -
      See Also:
    • getKeyIdentifierType

      public int getKeyIdentifierType()
      Gets the value of the keyIdentifierType.
      Returns:
      The keyIdentifyerType.
      See Also:
    • setAttachmentCallbackHandler

      public void setAttachmentCallbackHandler(CallbackHandler attachmentCallbackHandler)
    • setStoreBytesInAttachment

      public void setStoreBytesInAttachment(boolean storeBytesInAttachment)
    • setBodyID

      protected String setBodyID(Document doc) throws Exception
      Looks up or adds a body id.

      First try to locate the wsu:Id in the SOAP body element. If one is found, the value of the wsu:Id attribute is returned. Otherwise the method generates a new wsu:Id and an appropriate value.

      Parameters:
      doc - The SOAP envelope as Document
      Returns:
      The value of the wsu:Id attribute of the SOAP body
      Throws:
      Exception
    • setWsuId

      protected String setWsuId(Element bodyElement)
    • setUserInfo

      public void setUserInfo(String user, String password)
      Set the user and password info. Both information is used to get the user's private signing key.
      Parameters:
      user - This is the user's alias name in the keystore that identifies the private key to sign the document
      password - The user's password to get the private signing key from the keystore
    • getIdAllocator

      public WsuIdAllocator getIdAllocator()
    • setIdAllocator

      public void setIdAllocator(WsuIdAllocator idAllocator)
    • isExpandXopInclude

      public boolean isExpandXopInclude()
    • setExpandXopInclude

      public void setExpandXopInclude(boolean expandXopInclude)
    • getWsDocInfo

      public WSDocInfo getWsDocInfo()
    • setWsDocInfo

      public void setWsDocInfo(WSDocInfo wsDocInfo)
    • clean

      public void clean()