Class WSSecBase

java.lang.Object
org.apache.ws.security.message.WSSecBase
Direct Known Subclasses:
WSSecDerivedKeyBase, WSSecEncryptedKey, WSSecSAMLToken, WSSecSignature, 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.
Author:
Werner Dittmann (Werner.Dittmann@apache.org)
  • Field Details

    • user

      protected String user
    • password

      protected String password
    • keyIdentifierType

      protected int keyIdentifierType
    • parts

      protected Vector parts
    • doDebug

      protected boolean doDebug
    • wssConfig

      protected WSSConfig wssConfig
  • Constructor Details

    • WSSecBase

      public WSSecBase()
      Constructor.
  • Method Details

    • setParts

      public void setParts(Vector parts)
      Set which parts of the message to encrypt/sign.

      Parameters:
      parts - The vector containing the WSEncryptionPart objects
    • 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 keyIdentifyerType.
      Returns:
      The keyIdentifyerType.
      See Also:
    • setWsConfig

      public void setWsConfig(WSSConfig wsConfig)
      Parameters:
      wsConfig - The wsConfig to set.
    • 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 methode 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