From f5a13e6db96f2709cb09a4f37f9fc9ac5ecc0dd4 Mon Sep 17 00:00:00 2001 From: rnetuka Date: Fri, 28 Jul 2017 16:20:58 +0200 Subject: [PATCH] [BZ-1403939] @javax.jws.Oneway causes security-context to be lost --- .../apache/cxf/binding/soap/SoapMessage.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapMessage.java b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapMessage.java index 934e12a901d..6fc3070e44e 100644 --- a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapMessage.java +++ b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapMessage.java @@ -27,6 +27,7 @@ import org.apache.cxf.headers.Header; import org.apache.cxf.helpers.CastUtils; +import org.apache.cxf.interceptor.OneWayProcessorInterceptor; import org.apache.cxf.message.Message; import org.apache.cxf.message.MessageImpl; @@ -89,6 +90,20 @@ public Map getEnvelopeNs() { public boolean hasAdditionalEnvNs() { Map ns = getEnvelopeNs(); return ns != null && !ns.isEmpty(); - } + } + + @Override + public Object getContextualProperty(String key) { + Object property = super.getContextualProperty(key); + + // BZ-1403939 Picketbox uses thread local variables for authorization. By running in another thread, + // these will be lost. + if (OneWayProcessorInterceptor.USE_ORIGINAL_THREAD.equals(key)) { + setContextualProperty(OneWayProcessorInterceptor.USE_ORIGINAL_THREAD, true); + return true; + } + + return property; + } }