Updated Branches: refs/heads/ode-1.3.6.x 0e4014696 -> d65df2fc5
backporting ODE-509 in order to fix a security policy regression introduced by the upgrade to Axis 1.5.2. Project: http://git-wip-us.apache.org/repos/asf/ode/repo Commit: http://git-wip-us.apache.org/repos/asf/ode/commit/ae56a9d0 Tree: http://git-wip-us.apache.org/repos/asf/ode/tree/ae56a9d0 Diff: http://git-wip-us.apache.org/repos/asf/ode/diff/ae56a9d0 Branch: refs/heads/ode-1.3.6.x Commit: ae56a9d08d29b0d20dfc8f49af085bf653c2027a Parents: f55603d Author: Tammo van Lessen <[email protected]> Authored: Mon Aug 26 00:14:31 2013 +0200 Committer: Tammo van Lessen <[email protected]> Committed: Mon Aug 26 00:14:31 2013 +0200 ---------------------------------------------------------------------- .../axis2/hooks/ODEAxisOperationDispatcher.java | 18 +++++++----- .../axis2/hooks/ODEAxisServiceDispatcher.java | 29 +++++++++++++++----- 2 files changed, 33 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ode/blob/ae56a9d0/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisOperationDispatcher.java ---------------------------------------------------------------------- diff --git a/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisOperationDispatcher.java b/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisOperationDispatcher.java index 63c52a6..5354872 100644 --- a/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisOperationDispatcher.java +++ b/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisOperationDispatcher.java @@ -19,22 +19,20 @@ package org.apache.ode.axis2.hooks; +import javax.xml.namespace.QName; + import org.apache.axiom.om.OMElement; import org.apache.axis2.AxisFault; -import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.HandlerDescription; import org.apache.axis2.engine.AbstractDispatcher; -import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.i18n.Messages; import org.apache.commons.collections.map.MultiKeyMap; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import javax.xml.namespace.QName; - /** * Dispatches the service based on the information from the target endpoint URL. */ @@ -55,7 +53,9 @@ public class ODEAxisOperationDispatcher extends AbstractDispatcher { // way to identify the operation. String action = messageContext.getWSAAction(); if (action != null) { - log.debug(Messages.getMessage("checkingoperation", action)); + if (log.isDebugEnabled()) { + log.debug(Messages.getMessage("checkingoperation", action)); + } operation = service.getOperationByAction(action); if (operation != null) return operation; @@ -67,11 +67,15 @@ public class ODEAxisOperationDispatcher extends AbstractDispatcher { OMElement bodyFirstChild = messageContext.getEnvelope().getBody().getFirstElement(); if (bodyFirstChild != null) { String localName = bodyFirstChild.getLocalName(); - log.debug("Checking for Operation using SOAP message body's first child's local name : " + if (log.isDebugEnabled()) { + log.debug("Checking for Operation using SOAP message body's first child's local name : " + localName); + } operation = service.getOperation(new QName(localName)); if (operation != null) { - log.debug("Found operation " + operation); + if (log.isDebugEnabled()) { + log.debug("Found operation " + operation); + } return operation; } http://git-wip-us.apache.org/repos/asf/ode/blob/ae56a9d0/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisServiceDispatcher.java ---------------------------------------------------------------------- diff --git a/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisServiceDispatcher.java b/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisServiceDispatcher.java index 2943443..e52d971 100644 --- a/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisServiceDispatcher.java +++ b/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisServiceDispatcher.java @@ -19,7 +19,10 @@ package org.apache.ode.axis2.hooks; -import org.apache.axiom.om.OMElement; +import java.util.ArrayList; + +import javax.xml.namespace.QName; + import org.apache.axis2.AxisFault; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.context.MessageContext; @@ -28,12 +31,12 @@ import org.apache.axis2.description.AxisService; import org.apache.axis2.description.HandlerDescription; import org.apache.axis2.engine.AbstractDispatcher; import org.apache.axis2.engine.AxisConfiguration; -import org.apache.axis2.i18n.Messages; -import org.apache.commons.collections.map.MultiKeyMap; +import org.apache.axis2.util.PolicyUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; - -import javax.xml.namespace.QName; +import org.apache.neethi.Policy; +import org.apache.neethi.PolicyComponent; +import org.apache.rampart.RampartMessageData; /** * Dispatches the service based on the information from the target endpoint URL. @@ -59,7 +62,9 @@ public class ODEAxisServiceDispatcher extends AbstractDispatcher { EndpointReference toEPR = messageContext.getTo(); if (toEPR != null) { - log.debug("Checking for Service using target endpoint address : " + toEPR.getAddress()); + if (log.isDebugEnabled()) { + log.debug("Checking for Service using target endpoint address : " + toEPR.getAddress()); + } // The only thing we understand if a service name that // follows /processes/ in the request URL. @@ -69,7 +74,17 @@ public class ODEAxisServiceDispatcher extends AbstractDispatcher { messageContext.getConfigurationContext().getAxisConfiguration(); AxisService service = registry.getService(path); if (service!=null) { - log.debug("Found service in registry from name " + path + ": " + service); + if (log.isDebugEnabled()) { + log.debug("Found service in registry from name " + path + ": " + service); + } + // Axis2 >1.3 is less clever than 1.3. See ODE-509 + // We have to do additional work for him. + // TODO: Check if there is a better workaround possible. + Policy policy = PolicyUtil.getMergedPolicy(new ArrayList<PolicyComponent>(service.getPolicySubject().getAttachedPolicyComponents()), service); + if (policy != null) { + if (log.isDebugEnabled()) log.debug("Apply policy: " + policy.getName()); + messageContext.setProperty(RampartMessageData.KEY_RAMPART_POLICY, policy); + } return service; } }
