diff --git a/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java b/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java index ebd210db8..9b1188d98 100644 --- a/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java +++ b/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java @@ -87,7 +87,7 @@ import org.jboss.wsf.stack.cxf.i18n.Messages; import org.jboss.wsf.stack.cxf.interceptor.EndpointAssociationInterceptor; import org.jboss.wsf.stack.cxf.interceptor.GracefulShutdownInterceptor; -import org.jboss.wsf.stack.cxf.interceptor.HandlerAuthInterceptor; +import org.jboss.wsf.stack.cxf.interceptor.HandlerConfigInterceptor; import org.jboss.wsf.stack.cxf.interceptor.NsCtxSelectorStoreInterceptor; import org.jboss.wsf.stack.cxf.interceptor.WSDLSoapAddressRewriteInterceptor; import org.jboss.wsf.stack.cxf.management.InstrumentationManagerExtImpl; @@ -366,9 +366,9 @@ protected void setInterceptors(Bus bus, Deployment dep, Map prop final String p = (props != null) ? props.get(Constants.JBWS_CXF_DISABLE_HANDLER_AUTH_CHECKS) : null; if ((p == null || (!"true".equalsIgnoreCase(p) && !"1".equalsIgnoreCase(p))) && !Boolean.getBoolean(Constants.JBWS_CXF_DISABLE_HANDLER_AUTH_CHECKS)) { - bus.getInInterceptors().add(new HandlerAuthInterceptor()); + bus.getInInterceptors().add(new HandlerConfigInterceptor()); } else { - bus.getInInterceptors().add(new HandlerAuthInterceptor(true)); + bus.getInInterceptors().add(new HandlerConfigInterceptor(true)); } final SOAPAddressRewriteMetadata sarm = dep.getAttachment(SOAPAddressRewriteMetadata.class); diff --git a/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/HandlerAuthInterceptor.java b/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/HandlerConfigInterceptor.java similarity index 91% rename from modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/HandlerAuthInterceptor.java rename to modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/HandlerConfigInterceptor.java index 0ac55f806..4eea7dd10 100644 --- a/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/HandlerAuthInterceptor.java +++ b/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/HandlerConfigInterceptor.java @@ -47,38 +47,39 @@ import org.jboss.wsf.stack.cxf.JAXPDelegateClassLoader; /** - * Interceptor which checks the current principal is authorized to - * call a given handler - * + * Interceptor that configures a jbossws handler chain and can skip authentication. + * It set {@code JBossWSHandlerChainInvoker} to use correct Thread Context Class Loader + * and perform security checks before invoking the handlers. * @author alessio.soldano@jboss.com + * @author ema@redhat.com * @since 23-Sep-2013 */ -public class HandlerAuthInterceptor extends AbstractPhaseInterceptor +public class HandlerConfigInterceptor extends AbstractPhaseInterceptor { - private static final String KEY = HandlerAuthInterceptor.class.getName() + ".SECURITY_EXCEPTION"; + private static final String KEY = HandlerConfigInterceptor.class.getName() + ".SECURITY_EXCEPTION"; - private final boolean skip; - public HandlerAuthInterceptor() + private final boolean skipAuth; + public HandlerConfigInterceptor() { super(Phase.PRE_PROTOCOL_FRONTEND); addBefore(SOAPHandlerInterceptor.class.getName()); addBefore(LogicalHandlerInInterceptor.class.getName()); - skip = false; + skipAuth = false; } /** - * Create a {@code HandlerAuthInterceptor} that can optionally skip authentication. + * Create a {@code HandlerConfigInterceptor} that can optionally skip authentication. * When the authentication is skipped, it added a customized {@code JBossWSHandlerChainInvoker} * which set the correct TCCL to allow the handler to access CDI - * Please see + * Please see https://issues.redhat.com/browse/JBWS-4430 * This interceptor will be added to CXF interceptor chain * @param skipAuth a boolean flag indicating whether to skip authentication. **/ - public HandlerAuthInterceptor(boolean skipAuth) + public HandlerConfigInterceptor(boolean skipAuth) { super(Phase.PRE_PROTOCOL_FRONTEND); addBefore(SOAPHandlerInterceptor.class.getName()); addBefore(LogicalHandlerInInterceptor.class.getName()); - skip = skipAuth; + this.skipAuth = skipAuth; } @Override @@ -94,7 +95,7 @@ public void handleMessage(Message message) throws Fault @SuppressWarnings("rawtypes") final List handlerChain = ep.getJaxwsBinding().getHandlerChain(); if (handlerChain != null && !handlerChain.isEmpty()) { //save - invoker = new JBossWSHandlerChainInvoker(handlerChain, isOutbound(message, ex), skip); + invoker = new JBossWSHandlerChainInvoker(handlerChain, isOutbound(message, ex), skipAuth); ex.put(HandlerChainInvoker.class, invoker); } } diff --git a/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws4430/CDIOutInterceptor.java b/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws4430/CDIOutInterceptor.java index 41e356799..470af4b7a 100644 --- a/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws4430/CDIOutInterceptor.java +++ b/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws4430/CDIOutInterceptor.java @@ -20,6 +20,7 @@ import org.apache.cxf.interceptor.Fault; import org.apache.cxf.message.Message; import org.apache.cxf.message.MessageUtils; +import org.apache.cxf.phase.AbstractPhaseInterceptor; import org.apache.cxf.phase.Phase; import org.jboss.wsf.stack.cxf.interceptor.AbstractTCCLPhaseInterceptor; diff --git a/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws4430/JBWS4430TestCase.java b/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws4430/JBWS4430TestCase.java index 43fc846ac..6a85c7055 100644 --- a/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws4430/JBWS4430TestCase.java +++ b/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws4430/JBWS4430TestCase.java @@ -47,7 +47,7 @@ public class JBWS4430TestCase extends JBossWSTest { public static WebArchive createDeployment() { WebArchive archive = ShrinkWrap.create(WebArchive.class, DEP + ".war"); archive.setManifest(new StringAsset("Manifest-Version: 1.0\n" - + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-server\n")) + + "Dependencies: org.apache.cxf,org.jboss.ws.cxf.jbossws-cxf-server\n")) .addClasses(HelloBean.class, DelegateBean.class, EmptyBean.class, CDIOutInterceptor.class, LoggingHandler.class) .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/jbws4430/WEB-INF/wsdl/HelloWorld.wsdl"), "wsdl/HelloWorld.wsdl") .add(new FileAsset(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/jbws4430/handlers.xml")), "WEB-INF/classes/handlers.xml")