Class AbstractAuditInterceptor<T extends WsAuditDataset>
java.lang.Object
org.apache.cxf.phase.AbstractPhaseInterceptor<org.apache.cxf.binding.soap.SoapMessage>
org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor
org.openehealth.ipf.commons.ihe.ws.cxf.AbstractSafeInterceptor
org.openehealth.ipf.commons.ihe.ws.cxf.audit.AbstractAuditInterceptor<T>
- All Implemented Interfaces:
org.apache.cxf.binding.soap.interceptor.SoapInterceptor,Interceptor<org.apache.cxf.binding.soap.SoapMessage>,PhaseInterceptor<org.apache.cxf.binding.soap.SoapMessage>
- Direct Known Subclasses:
AuditInRequestInterceptor,AuditOutRequestInterceptor,AuditResponseInterceptor
public abstract class AbstractAuditInterceptor<T extends WsAuditDataset>
extends AbstractSafeInterceptor
Base class for all ATNA audit-related CXF interceptors.
- Author:
- Dmytro Rud
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringKey used to store audit datasets in Web Service contexts. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractAuditInterceptor(String phase, AuditStrategy<T> auditStrategy, AuditContext auditContext) Constructor which sets a strategy. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidenrichAuditDatasetFromRequest(org.apache.cxf.binding.soap.SoapMessage message, Header.Direction headerDirection, WsAuditDataset auditDataset) Enriches the given audit dataset with elements from the given CXF request message.protected voidenrichAuditDatasetFromResponse(org.apache.cxf.binding.soap.SoapMessage message, Header.Direction headerDirection, WsAuditDataset auditDataset) Enriches the given audit dataset with elements from the given CXF response message.protected static voidextractAddressesFromServletRequest(org.apache.cxf.binding.soap.SoapMessage message, WsAuditDataset auditDataset) Extracts service URI and client IP address from the servlet request.protected static voidextractClientCertificateCommonName(org.apache.cxf.binding.soap.SoapMessage message, WsAuditDataset auditDataset) Extract TLS information from servlet request, if availableprotected static ObjectextractPojo(Message message) Extracts POJO from the given CXF message.protected static voidextractUserIdFromWSAddressing(org.apache.cxf.binding.soap.SoapMessage message, boolean isInbound, boolean inverseWsaDirection, WsAuditDataset auditDataset) Extracts user ID from an WS-Addressing SOAP header and stores it in the given audit dataset.protected TgetAuditDataset(org.apache.cxf.binding.soap.SoapMessage message) Returns an audit dataset instance which corresponds to the given message.protected AuditStrategy<T> Returns the audit strategy associated with this interceptor.Methods inherited from class org.openehealth.ipf.commons.ihe.ws.cxf.AbstractSafeInterceptor
handleMessage, processMethods inherited from class org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor
getFaultCodePrefix, getRoles, getUnderstoodHeaders, prepareStackTraceMethods inherited from class org.apache.cxf.phase.AbstractPhaseInterceptor
addAfter, addAfter, addBefore, addBefore, getAdditionalInterceptors, getAfter, getBefore, getId, getPhase, handleFault, isGET, isRequestor, setAfter, setBeforeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.cxf.interceptor.Interceptor
handleFault
-
Field Details
-
DATASET_CONTEXT_KEY
Key used to store audit datasets in Web Service contexts.
-
-
Constructor Details
-
AbstractAuditInterceptor
protected AbstractAuditInterceptor(String phase, AuditStrategy<T> auditStrategy, AuditContext auditContext) Constructor which sets a strategy.- Parameters:
phase- the phase in which to use this interceptor.auditStrategy- an audit strategy instance.nullvalues are explicitly prohibited.
-
-
Method Details
-
getAuditDataset
Returns an audit dataset instance which corresponds to the given message.When no such instance is currently associated with the message, a new one will be created by means of the corresponding
AuditStrategyand registered in the message's exchange.- Parameters:
message- CXF message currently handled by this interceptor.- Returns:
- an audit dataset instance, or
nullwhen this instance could be neither obtained nor created from scratch.
-
getAuditStrategy
Returns the audit strategy associated with this interceptor.- Returns:
- an audit strategy instance or
nullwhen none configured.
-
extractUserIdFromWSAddressing
protected static void extractUserIdFromWSAddressing(org.apache.cxf.binding.soap.SoapMessage message, boolean isInbound, boolean inverseWsaDirection, WsAuditDataset auditDataset) Extracts user ID from an WS-Addressing SOAP header and stores it in the given audit dataset.- Parameters:
message- CXF message.isInbound-truewhen the CXF message is an inbound one,falseotherwise.inverseWsaDirection-truewhen direction is actually inversed, i.e. when the user ID should be taken not from the "ReplyTo:" WS-Addressing header, but from "To:" --- useful for asynchronous responses, where the endpoint which receives the response is not the endpoint which sent the request.auditDataset- target audit dataset.
-
enrichAuditDatasetFromRequest
protected void enrichAuditDatasetFromRequest(org.apache.cxf.binding.soap.SoapMessage message, Header.Direction headerDirection, WsAuditDataset auditDataset) Enriches the given audit dataset with elements from the given CXF request message.- Parameters:
message- CXF request message.headerDirection- direction of SOAP headers.auditDataset- target ATNA audit dataset.
-
enrichAuditDatasetFromResponse
protected void enrichAuditDatasetFromResponse(org.apache.cxf.binding.soap.SoapMessage message, Header.Direction headerDirection, WsAuditDataset auditDataset) Enriches the given audit dataset with elements from the given CXF response message.- Parameters:
message- CXF response message.headerDirection- direction of SOAP headers.auditDataset- target ATNA audit dataset.
-
extractAddressesFromServletRequest
protected static void extractAddressesFromServletRequest(org.apache.cxf.binding.soap.SoapMessage message, WsAuditDataset auditDataset) Extracts service URI and client IP address from the servlet request. -
extractClientCertificateCommonName
protected static void extractClientCertificateCommonName(org.apache.cxf.binding.soap.SoapMessage message, WsAuditDataset auditDataset) Extract TLS information from servlet request, if available -
extractPojo
Extracts POJO from the given CXF message.- Returns:
- POJO or
nullwhen none found.
-
getAuditContext
-