Package org.apache.wss4j.dom.handler
Class WSHandler
- java.lang.Object
-
- org.apache.wss4j.dom.handler.WSHandler
-
public abstract class WSHandler extends Object
Extracted from WSDoAllReceiver and WSDoAllSender Extended to all passwordless UsernameTokens and configurable identities.
-
-
Constructor Summary
Constructors Constructor Description WSHandler()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected booleancheckReceiverResults(List<WSSecurityEngineResult> wsResult, List<Integer> actions)protected booleancheckReceiverResultsAnyOrder(List<WSSecurityEngineResult> wsResult, List<Integer> actions)protected voidcheckSignatureConfirmation(RequestData reqData, WSHandlerResult handlerResults)protected voiddecodeAlgorithmSuite(RequestData reqData)protected booleandecodeBooleanConfigValue(Object messageContext, String configTag, boolean defaultToTrue)protected voiddecodeDecryptionParameter(RequestData reqData)protected voiddecodeEncryptionParameter(RequestData reqData)protected intdecodeFutureTimeToLive(RequestData reqData, boolean timestamp)Decode the FutureTimeToLive parameter for either a Timestamp or a UsernameToken Created element, depending on the boolean argumentprotected StringdecodePasswordType(RequestData reqData)protected voiddecodeSignatureParameter(RequestData reqData)protected voiddecodeSignatureParameter2(RequestData reqData)intdecodeTimeToLive(RequestData reqData, boolean timestamp)Decode the TimeToLive parameter for either a Timestamp or a UsernameToken Created element, depending on the boolean argumentprotected voiddecodeUTParameter(RequestData reqData)protected voiddoReceiverAction(List<Integer> actions, RequestData reqData)protected voiddoSenderAction(Document doc, RequestData reqData, List<HandlerAction> actions, boolean isRequest)Performs all defined security actions to set-up the SOAP request.CallbackHandlergetCallbackHandler(String callbackHandlerClass, String callbackHandlerRef, RequestData requestData)Get a CallbackHandler instance.ClassLoadergetClassLoader()Returns the classloader to be used for loading the callback classabstract ObjectgetOption(String key)abstract StringgetPassword(Object msgContext)CallbackHandlergetPasswordCallbackHandler(RequestData reqData)Get a CallbackHandler instance to obtain passwords.org.apache.wss4j.common.ext.WSPasswordCallbackgetPasswordCB(String username, int doAction, CallbackHandler callbackHandler, RequestData requestData)Get a password callback (WSPasswordCallback object) from a CallbackHandler instanceprotected org.apache.wss4j.common.crypto.PasswordEncryptorgetPasswordEncryptor(RequestData requestData)abstract ObjectgetProperty(Object msgContext, String key)StringgetString(String key, Object mc)Looks up key first viagetOption(String)and if not found there, viagetProperty(Object, String)StringgetStringOption(String key)Returns the option onname.protected org.apache.wss4j.common.crypto.CryptoloadCrypto(String cryptoPropertyFile, String cryptoPropertyRefId, RequestData requestData)Load a Crypto instance.protected org.apache.wss4j.common.crypto.CryptoloadCryptoFromPropertiesFile(String propFilename, RequestData reqData)A hook to allow subclass to load Crypto instances from property files in a different way.protected org.apache.wss4j.common.crypto.CryptoloadDecryptionCrypto(RequestData requestData)Hook to allow subclasses to load their Decryption Crypto however they see fit.protected org.apache.wss4j.common.crypto.CryptoloadEncryptionCrypto(RequestData requestData)Hook to allow subclasses to load their Encryption Crypto however they see fit.org.apache.wss4j.common.crypto.CryptoloadSignatureCrypto(RequestData requestData)Hook to allow subclasses to load their Signature creation Crypto however they see fit.org.apache.wss4j.common.crypto.CryptoloadSignatureVerificationCrypto(RequestData requestData)Hook to allow subclasses to load their Signature verification Crypto however they see fit.abstract voidsetPassword(Object msgContext, String password)abstract voidsetProperty(Object msgContext, String key, Object value)
-
-
-
Method Detail
-
doSenderAction
protected void doSenderAction(Document doc, RequestData reqData, List<HandlerAction> actions, boolean isRequest) throws org.apache.wss4j.common.ext.WSSecurityException
Performs all defined security actions to set-up the SOAP request.- Parameters:
doc- the request as DOM documentreqData- a data storage to pass values around between methodsactions- a list holding the actions to do in the order defined in the deployment file or property, plus an optional associated SecurityActionToken object for that Action- Throws:
org.apache.wss4j.common.ext.WSSecurityException
-
doReceiverAction
protected void doReceiverAction(List<Integer> actions, RequestData reqData) throws org.apache.wss4j.common.ext.WSSecurityException
- Throws:
org.apache.wss4j.common.ext.WSSecurityException
-
checkReceiverResults
protected boolean checkReceiverResults(List<WSSecurityEngineResult> wsResult, List<Integer> actions)
-
checkReceiverResultsAnyOrder
protected boolean checkReceiverResultsAnyOrder(List<WSSecurityEngineResult> wsResult, List<Integer> actions)
-
checkSignatureConfirmation
protected void checkSignatureConfirmation(RequestData reqData, WSHandlerResult handlerResults) throws org.apache.wss4j.common.ext.WSSecurityException
- Throws:
org.apache.wss4j.common.ext.WSSecurityException
-
decodeUTParameter
protected void decodeUTParameter(RequestData reqData) throws org.apache.wss4j.common.ext.WSSecurityException
- Throws:
org.apache.wss4j.common.ext.WSSecurityException
-
decodeSignatureParameter
protected void decodeSignatureParameter(RequestData reqData) throws org.apache.wss4j.common.ext.WSSecurityException
- Throws:
org.apache.wss4j.common.ext.WSSecurityException
-
decodeAlgorithmSuite
protected void decodeAlgorithmSuite(RequestData reqData) throws org.apache.wss4j.common.ext.WSSecurityException
- Throws:
org.apache.wss4j.common.ext.WSSecurityException
-
decodeEncryptionParameter
protected void decodeEncryptionParameter(RequestData reqData) throws org.apache.wss4j.common.ext.WSSecurityException
- Throws:
org.apache.wss4j.common.ext.WSSecurityException
-
decodeTimeToLive
public int decodeTimeToLive(RequestData reqData, boolean timestamp)
Decode the TimeToLive parameter for either a Timestamp or a UsernameToken Created element, depending on the boolean argument
-
decodeFutureTimeToLive
protected int decodeFutureTimeToLive(RequestData reqData, boolean timestamp)
Decode the FutureTimeToLive parameter for either a Timestamp or a UsernameToken Created element, depending on the boolean argument
-
decodePasswordType
protected String decodePasswordType(RequestData reqData) throws org.apache.wss4j.common.ext.WSSecurityException
- Throws:
org.apache.wss4j.common.ext.WSSecurityException
-
decodeBooleanConfigValue
protected boolean decodeBooleanConfigValue(Object messageContext, String configTag, boolean defaultToTrue) throws org.apache.wss4j.common.ext.WSSecurityException
- Throws:
org.apache.wss4j.common.ext.WSSecurityException
-
loadSignatureCrypto
public org.apache.wss4j.common.crypto.Crypto loadSignatureCrypto(RequestData requestData) throws org.apache.wss4j.common.ext.WSSecurityException
Hook to allow subclasses to load their Signature creation Crypto however they see fit.- Parameters:
requestData- the RequestData object- Returns:
- a Crypto instance to use for Signature creation
- Throws:
org.apache.wss4j.common.ext.WSSecurityException
-
loadSignatureVerificationCrypto
public org.apache.wss4j.common.crypto.Crypto loadSignatureVerificationCrypto(RequestData requestData) throws org.apache.wss4j.common.ext.WSSecurityException
Hook to allow subclasses to load their Signature verification Crypto however they see fit.- Parameters:
requestData- the RequestData object- Returns:
- a Crypto instance to use for Signature verification
- Throws:
org.apache.wss4j.common.ext.WSSecurityException
-
loadDecryptionCrypto
protected org.apache.wss4j.common.crypto.Crypto loadDecryptionCrypto(RequestData requestData) throws org.apache.wss4j.common.ext.WSSecurityException
Hook to allow subclasses to load their Decryption Crypto however they see fit.- Parameters:
requestData- the RequestData object- Returns:
- a Crypto instance to use for Decryption creation/verification
- Throws:
org.apache.wss4j.common.ext.WSSecurityException
-
loadEncryptionCrypto
protected org.apache.wss4j.common.crypto.Crypto loadEncryptionCrypto(RequestData requestData) throws org.apache.wss4j.common.ext.WSSecurityException
Hook to allow subclasses to load their Encryption Crypto however they see fit.- Parameters:
requestData- the RequestData object- Returns:
- a Crypto instance to use for Encryption creation/verification
- Throws:
org.apache.wss4j.common.ext.WSSecurityException
-
loadCrypto
protected org.apache.wss4j.common.crypto.Crypto loadCrypto(String cryptoPropertyFile, String cryptoPropertyRefId, RequestData requestData) throws org.apache.wss4j.common.ext.WSSecurityException
Load a Crypto instance. Firstly, it tries to use the cryptoPropertyRefId tag to retrieve a Crypto object via a custom reference Id. Failing this, it tries to load the crypto instance via the cryptoPropertyFile tag.- Parameters:
requestData- the RequestData object- Returns:
- a Crypto instance to use for Encryption creation/verification
- Throws:
org.apache.wss4j.common.ext.WSSecurityException
-
loadCryptoFromPropertiesFile
protected org.apache.wss4j.common.crypto.Crypto loadCryptoFromPropertiesFile(String propFilename, RequestData reqData) throws org.apache.wss4j.common.ext.WSSecurityException
A hook to allow subclass to load Crypto instances from property files in a different way.- Parameters:
propFilename- The property file namereqData- The RequestData object- Returns:
- A Crypto instance that has been loaded
- Throws:
org.apache.wss4j.common.ext.WSSecurityException
-
getCallbackHandler
public CallbackHandler getCallbackHandler(String callbackHandlerClass, String callbackHandlerRef, RequestData requestData) throws org.apache.wss4j.common.ext.WSSecurityException
Get a CallbackHandler instance. First try to get an instance via the callbackHandlerRef on the message context. Failing that, try to load a new instance of the CallbackHandler via the callbackHandlerClass argument.- Parameters:
callbackHandlerClass- The class name of the CallbackHandler instancecallbackHandlerRef- The reference name of the CallbackHandler instancerequestData- The RequestData which supplies the message context- Returns:
- a CallbackHandler instance
- Throws:
org.apache.wss4j.common.ext.WSSecurityException
-
getPasswordCallbackHandler
public CallbackHandler getPasswordCallbackHandler(RequestData reqData) throws org.apache.wss4j.common.ext.WSSecurityException
Get a CallbackHandler instance to obtain passwords.- Parameters:
reqData- The RequestData which supplies the message context- Returns:
- the CallbackHandler instance to obtain passwords.
- Throws:
org.apache.wss4j.common.ext.WSSecurityException
-
getPasswordEncryptor
protected org.apache.wss4j.common.crypto.PasswordEncryptor getPasswordEncryptor(RequestData requestData)
-
getPasswordCB
public org.apache.wss4j.common.ext.WSPasswordCallback getPasswordCB(String username, int doAction, CallbackHandler callbackHandler, RequestData requestData) throws org.apache.wss4j.common.ext.WSSecurityException
Get a password callback (WSPasswordCallback object) from a CallbackHandler instance- Parameters:
username- The username to supply to the CallbackHandlerdoAction- The action to performcallbackHandler- The CallbackHandler instancerequestData- The RequestData which supplies the message context- Returns:
- the WSPasswordCallback object containing the password
- Throws:
org.apache.wss4j.common.ext.WSSecurityException
-
decodeSignatureParameter2
protected void decodeSignatureParameter2(RequestData reqData) throws org.apache.wss4j.common.ext.WSSecurityException
- Throws:
org.apache.wss4j.common.ext.WSSecurityException
-
decodeDecryptionParameter
protected void decodeDecryptionParameter(RequestData reqData) throws org.apache.wss4j.common.ext.WSSecurityException
- Throws:
org.apache.wss4j.common.ext.WSSecurityException
-
getString
public String getString(String key, Object mc)
Looks up key first viagetOption(String)and if not found there, viagetProperty(Object, String)- Parameters:
key- the key to search for. May not be null.mc- the message context to search.- Returns:
- the value found.
- Throws:
IllegalArgumentException- ifkeyis null.
-
getStringOption
public String getStringOption(String key)
Returns the option onname.- Parameters:
key- the non-null key of the option.- Returns:
- the option on
keyifkeyexists and is of type java.lang.String; otherwise null.
-
getClassLoader
public ClassLoader getClassLoader()
Returns the classloader to be used for loading the callback class- Returns:
- class loader
-
-