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 boolean
addWSUNamespace
protected CallbackHandler
attachmentCallbackHandler
protected CallbackLookup
callbackLookup
protected boolean
expandXopInclude
protected int
keyIdentifierType
protected String
password
protected boolean
storeBytesInAttachment
protected String
user
-
Constructor Summary
Constructors Constructor Description WSSecBase(WSSecHeader securityHeader)
WSSecBase(Document doc)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clean()
protected Document
getDocument()
WsuIdAllocator
getIdAllocator()
int
getKeyIdentifierType()
Gets the value of thekeyIdentifierType
.List<WSEncryptionPart>
getParts()
Get which parts of the message to encrypt/sign.WSSecHeader
getSecurityHeader()
WSDocInfo
getWsDocInfo()
boolean
isExpandXopInclude()
void
setAttachmentCallbackHandler(CallbackHandler attachmentCallbackHandler)
protected String
setBodyID(Document doc)
Looks up or adds a body id.void
setCallbackLookup(CallbackLookup callbackLookup)
void
setExpandXopInclude(boolean expandXopInclude)
void
setIdAllocator(WsuIdAllocator idAllocator)
void
setKeyIdentifierType(int keyIdType)
Sets which key identifier to use.void
setStoreBytesInAttachment(boolean storeBytesInAttachment)
void
setUserInfo(String user, String password)
Set the user and password info.void
setWsDocInfo(WSDocInfo wsDocInfo)
protected String
setWsuId(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 themethod
or themethod
function 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:Id
in the SOAP body element. If one is found, the value of thewsu:Id
attribute is returned. Otherwise the method generates a newwsu:Id
and an appropriate value.- Parameters:
doc
- The SOAP envelope asDocument
- Returns:
- The value of the
wsu:Id
attribute 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()
-
-