Apache CXF API

org.apache.cxf.ws.security.wss4j
Class WSS4JInInterceptor

java.lang.Object
  extended by org.apache.wss4j.dom.handler.WSHandler
      extended by org.apache.cxf.ws.security.wss4j.AbstractWSS4JInterceptor
          extended by org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor
All Implemented Interfaces:
SoapInterceptor, Interceptor<SoapMessage>, PhaseInterceptor<SoapMessage>
Direct Known Subclasses:
AbstractUsernameTokenAuthenticatingInterceptor, PolicyBasedWSS4JInInterceptor

public class WSS4JInInterceptor
extends AbstractWSS4JInterceptor

Performs WS-Security inbound actions.


Field Summary
static String PRINCIPAL_RESULT
           
static String PROCESSOR_MAP
           
static String SAML_ROLE_ATTRIBUTENAME_DEFAULT
          This configuration tag specifies the default attribute name where the roles are present The default is "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role".
static String SECURITY_PROCESSED
           
static String SIGNATURE_RESULT
           
static String TIMESTAMP_RESULT
           
static String VALIDATOR_MAP
           
 
Fields inherited from class org.apache.wss4j.dom.handler.WSHandler
cryptos, secEngine
 
Constructor Summary
WSS4JInInterceptor()
           
WSS4JInInterceptor(boolean ignore)
           
WSS4JInInterceptor(Map<String,Object> properties)
           
 
Method Summary
protected  void advanceBody(SoapMessage msg, Node body)
           
protected  void computeAction(SoapMessage msg, org.apache.wss4j.dom.handler.RequestData reqData)
          Do whatever is necessary to determine the action for the incoming message and do whatever other setup work is necessary.
protected  void configureReplayCaches(org.apache.wss4j.dom.handler.RequestData reqData, List<Integer> actions, SoapMessage msg)
           
protected  SecurityContext createSecurityContext(Principal p)
           
protected static org.apache.wss4j.dom.WSSecurityEngine createSecurityEngine(Map<QName,Object> map)
           
protected  void doResults(SoapMessage msg, String actor, Element soapHeader, Element soapBody, List<org.apache.wss4j.dom.WSSecurityEngineResult> wsResult)
           
protected  void doResults(SoapMessage msg, String actor, Element soapHeader, Element soapBody, List<org.apache.wss4j.dom.WSSecurityEngineResult> wsResult, boolean utWithCallbacks)
           
protected  CallbackHandler getCallback(org.apache.wss4j.dom.handler.RequestData reqData)
           
protected  CallbackHandler getCallback(org.apache.wss4j.dom.handler.RequestData reqData, boolean utWithCallbacks)
           
 Object getProperty(Object msgContext, String key)
           
protected  org.apache.wss4j.common.cache.ReplayCache getReplayCache(SoapMessage message, String booleanKey, String instanceKey)
          Get a ReplayCache instance.
protected  org.apache.wss4j.dom.WSSecurityEngine getSecurityEngine(boolean utWithCallbacks)
           
 void handleMessage(SoapMessage msg)
          Intercepts a message.
 boolean isGET(SoapMessage message)
           
protected  boolean isNonceCacheRequired(List<Integer> actions, SoapMessage msg)
          Is a Nonce Cache required, i.e.
protected  boolean isSamlCacheRequired(List<Integer> actions, SoapMessage msg)
          Is a SAML Cache required, i.e.
protected  boolean isSecurityContextPrincipal(Principal p, List<org.apache.wss4j.dom.WSSecurityEngineResult> wsResult)
          Checks if a given WSS4J Principal can be represented as a user principal inside SecurityContext.
protected  boolean isTimestampCacheRequired(List<Integer> actions, SoapMessage msg)
          Is a Timestamp cache required, i.e.
protected  void setAlgorithmSuites(SoapMessage message, org.apache.wss4j.dom.handler.RequestData data)
          Set a WSS4J AlgorithmSuite object on the RequestData context, to restrict the algorithms that are allowed for encryption, signature, etc.
 void setIgnoreActions(boolean i)
           
 
Methods inherited from class org.apache.cxf.ws.security.wss4j.AbstractWSS4JInterceptor
getAdditionalInterceptors, getAfter, getBefore, getId, getOption, getPassword, getPhase, getProperties, getRoles, getUnderstoodHeaders, handleFault, isRequestor, loadCryptoFromPropertiesFile, postHandleMessage, setAfter, setBefore, setId, setPassword, setPhase, setProperties, setProperty, setProperty, translateProperties
 
Methods inherited from class org.apache.wss4j.dom.handler.WSHandler
checkReceiverResults, checkReceiverResultsAnyOrder, checkSignatureConfirmation, decodeAddInclusivePrefixes, decodeAlgorithmSuite, decodeAllowUsernameTokenNoPassword, decodeBooleanConfigValue, decodeBSPCompliance, decodeCustomPasswordTypes, decodeDecryptionParameter, decodeEnableSignatureConfirmation, decodeEncryptionParameter, decodeFutureTimeToLive, decodeIncludeEncryptionToken, decodeIncludeSignatureToken, decodeMustUnderstand, decodeNamespaceQualifiedPasswordTypes, decodePasswordType, decodeRequireSignedEncryptedDataElements, decodeSamlSubjectConfirmationValidation, decodeSignatureParameter, decodeSignatureParameter2, decodeTimestampPrecision, decodeTimestampStrict, decodeTimeToLive, decodeUse200512Namespace, decodeUseEncodedPasswords, decodeUseSingleCertificate, decodeUTParameter, doReceiverAction, doSenderAction, getCallbackHandler, getClassLoader, getPasswordCallbackHandler, getPasswordCB, getPasswordEncryptor, getString, getStringOption, loadCrypto, loadDecryptionCrypto, loadEncryptionCrypto, loadSignatureCrypto, loadSignatureVerificationCrypto
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SAML_ROLE_ATTRIBUTENAME_DEFAULT

public static final String SAML_ROLE_ATTRIBUTENAME_DEFAULT
This configuration tag specifies the default attribute name where the roles are present The default is "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role".

See Also:
Constant Field Values

TIMESTAMP_RESULT

public static final String TIMESTAMP_RESULT
See Also:
Constant Field Values

SIGNATURE_RESULT

public static final String SIGNATURE_RESULT
See Also:
Constant Field Values

PRINCIPAL_RESULT

public static final String PRINCIPAL_RESULT
See Also:
Constant Field Values

PROCESSOR_MAP

public static final String PROCESSOR_MAP
See Also:
Constant Field Values

VALIDATOR_MAP

public static final String VALIDATOR_MAP
See Also:
Constant Field Values

SECURITY_PROCESSED

public static final String SECURITY_PROCESSED
Constructor Detail

WSS4JInInterceptor

public WSS4JInInterceptor()

WSS4JInInterceptor

public WSS4JInInterceptor(boolean ignore)

WSS4JInInterceptor

public WSS4JInInterceptor(Map<String,Object> properties)
Method Detail

setIgnoreActions

public void setIgnoreActions(boolean i)

getProperty

public Object getProperty(Object msgContext,
                          String key)
Overrides:
getProperty in class AbstractWSS4JInterceptor

isGET

public final boolean isGET(SoapMessage message)

handleMessage

public void handleMessage(SoapMessage msg)
                   throws Fault
Description copied from interface: Interceptor
Intercepts a message. Interceptors should NOT invoke handleMessage or handleFault on the next interceptor - the interceptor chain will take care of this.

Throws:
Fault

computeAction

protected void computeAction(SoapMessage msg,
                             org.apache.wss4j.dom.handler.RequestData reqData)
                      throws org.apache.wss4j.common.ext.WSSecurityException
Do whatever is necessary to determine the action for the incoming message and do whatever other setup work is necessary.

Parameters:
msg -
reqData -
Throws:
org.apache.wss4j.common.ext.WSSecurityException

configureReplayCaches

protected void configureReplayCaches(org.apache.wss4j.dom.handler.RequestData reqData,
                                     List<Integer> actions,
                                     SoapMessage msg)
                              throws org.apache.wss4j.common.ext.WSSecurityException
Throws:
org.apache.wss4j.common.ext.WSSecurityException

isNonceCacheRequired

protected boolean isNonceCacheRequired(List<Integer> actions,
                                       SoapMessage msg)
Is a Nonce Cache required, i.e. are we expecting a UsernameToken


isTimestampCacheRequired

protected boolean isTimestampCacheRequired(List<Integer> actions,
                                           SoapMessage msg)
Is a Timestamp cache required, i.e. are we expecting a Timestamp


isSamlCacheRequired

protected boolean isSamlCacheRequired(List<Integer> actions,
                                      SoapMessage msg)
Is a SAML Cache required, i.e. are we expecting a SAML Token


setAlgorithmSuites

protected void setAlgorithmSuites(SoapMessage message,
                                  org.apache.wss4j.dom.handler.RequestData data)
                           throws org.apache.wss4j.common.ext.WSSecurityException
Set a WSS4J AlgorithmSuite object on the RequestData context, to restrict the algorithms that are allowed for encryption, signature, etc.

Throws:
org.apache.wss4j.common.ext.WSSecurityException

doResults

protected void doResults(SoapMessage msg,
                         String actor,
                         Element soapHeader,
                         Element soapBody,
                         List<org.apache.wss4j.dom.WSSecurityEngineResult> wsResult)
                  throws SOAPException,
                         XMLStreamException,
                         org.apache.wss4j.common.ext.WSSecurityException
Throws:
SOAPException
XMLStreamException
org.apache.wss4j.common.ext.WSSecurityException

doResults

protected void doResults(SoapMessage msg,
                         String actor,
                         Element soapHeader,
                         Element soapBody,
                         List<org.apache.wss4j.dom.WSSecurityEngineResult> wsResult,
                         boolean utWithCallbacks)
                  throws SOAPException,
                         XMLStreamException,
                         org.apache.wss4j.common.ext.WSSecurityException
Throws:
SOAPException
XMLStreamException
org.apache.wss4j.common.ext.WSSecurityException

isSecurityContextPrincipal

protected boolean isSecurityContextPrincipal(Principal p,
                                             List<org.apache.wss4j.dom.WSSecurityEngineResult> wsResult)
Checks if a given WSS4J Principal can be represented as a user principal inside SecurityContext. Example, UsernameToken or PublicKey principals can be used to facilitate checking the user roles, etc.


advanceBody

protected void advanceBody(SoapMessage msg,
                           Node body)
                    throws SOAPException,
                           XMLStreamException,
                           org.apache.wss4j.common.ext.WSSecurityException
Throws:
SOAPException
XMLStreamException
org.apache.wss4j.common.ext.WSSecurityException

createSecurityContext

protected SecurityContext createSecurityContext(Principal p)

getCallback

protected CallbackHandler getCallback(org.apache.wss4j.dom.handler.RequestData reqData,
                                      boolean utWithCallbacks)
                               throws org.apache.wss4j.common.ext.WSSecurityException
Throws:
org.apache.wss4j.common.ext.WSSecurityException

getCallback

protected CallbackHandler getCallback(org.apache.wss4j.dom.handler.RequestData reqData)
                               throws org.apache.wss4j.common.ext.WSSecurityException
Throws:
org.apache.wss4j.common.ext.WSSecurityException

getSecurityEngine

protected org.apache.wss4j.dom.WSSecurityEngine getSecurityEngine(boolean utWithCallbacks)
Returns:
the WSSecurityEngine in use by this interceptor. This engine is defined to be the secEngineOverride instance, if defined in this class (and supplied through construction); otherwise, it is taken to be the default WSSecEngine instance (currently defined in the WSHandler base class).

createSecurityEngine

protected static org.apache.wss4j.dom.WSSecurityEngine createSecurityEngine(Map<QName,Object> map)
Returns:
a freshly minted WSSecurityEngine instance, using the (non-null) processor map, to be used to initialize the WSSecurityEngine instance.

getReplayCache

protected org.apache.wss4j.common.cache.ReplayCache getReplayCache(SoapMessage message,
                                                                   String booleanKey,
                                                                   String instanceKey)
Get a ReplayCache instance. It first checks to see whether caching has been explicitly enabled or disabled via the booleanKey argument. If it has been set to false then no replay caching is done (for this booleanKey). If it has not been specified, then caching is enabled only if we are not the initiator of the exchange. If it has been specified, then caching is enabled. It tries to get an instance of ReplayCache via the instanceKey argument from a contextual property, and failing that the message exchange. If it can't find any, then it defaults to using an EH-Cache instance and stores that on the message exchange.


Apache CXF API

Apache CXF