Package org.apache.wss4j.dom.message
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 Summary
Fields Modifier and Type Field Description protected booleanaddWSUNamespaceprotected CallbackHandlerattachmentCallbackHandlerprotected CallbackLookupcallbackLookupprotected booleanexpandXopIncludeprotected intkeyIdentifierTypeprotected Stringpasswordprotected booleanstoreBytesInAttachmentprotected Stringuser
-
Constructor Summary
Constructors Constructor Description WSSecBase(WSSecHeader securityHeader)WSSecBase(Document doc)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclean()protected DocumentgetDocument()WsuIdAllocatorgetIdAllocator()intgetKeyIdentifierType()Gets the value of thekeyIdentifierType.List<WSEncryptionPart>getParts()Get which parts of the message to encrypt/sign.WSSecHeadergetSecurityHeader()WSDocInfogetWsDocInfo()booleanisExpandXopInclude()voidsetAttachmentCallbackHandler(CallbackHandler attachmentCallbackHandler)protected StringsetBodyID(Document doc)Looks up or adds a body id.voidsetCallbackLookup(CallbackLookup callbackLookup)voidsetExpandXopInclude(boolean expandXopInclude)voidsetIdAllocator(WsuIdAllocator idAllocator)voidsetKeyIdentifierType(int keyIdType)Sets which key identifier to use.voidsetStoreBytesInAttachment(boolean storeBytesInAttachment)voidsetUserInfo(String user, String password)Set the user and password info.voidsetWsDocInfo(WSDocInfo wsDocInfo)protected StringsetWsuId(Element bodyElement)
-
-
-
Field Detail
-
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 Detail
-
WSSecBase
public WSSecBase(WSSecHeader securityHeader)
-
WSSecBase
public WSSecBase(Document doc)
-
-
Method Detail
-
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<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 themethodor themethodfunction to set up the key identification elements.
-
getKeyIdentifierType
public int getKeyIdentifierType()
Gets the value of thekeyIdentifierType.- Returns:
- The
keyIdentifyerType. - See Also:
WSConstants.ISSUER_SERIAL,WSConstants.ISSUER_SERIAL_QUOTE_FORMAT,WSConstants.BST_DIRECT_REFERENCE,WSConstants.X509_KEY_IDENTIFIER,WSConstants.SKI_KEY_IDENTIFIER
-
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 thewsu:Idin the SOAP body element. If one is found, the value of thewsu:Idattribute is returned. Otherwise the method generates a newwsu:Idand an appropriate value.- Parameters:
doc- The SOAP envelope asDocument- Returns:
- The value of the
wsu:Idattribute of the SOAP body - Throws:
Exception
-
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 documentpassword- 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()
-
-