You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2017/11/07 17:40:43 UTC
[cxf] branch master updated: CXF-7551 - Policy Based WSS4J Stax
Interceptors may not be correctly initialized
This is an automated email from the ASF dual-hosted git repository.
coheigea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git
The following commit(s) were added to refs/heads/master by this push:
new 0161dd8 CXF-7551 - Policy Based WSS4J Stax Interceptors may not be correctly initialized
0161dd8 is described below
commit 0161dd80785bc79d9c6df77f9bb8b512f879f480
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Tue Nov 7 17:03:50 2017 +0000
CXF-7551 - Policy Based WSS4J Stax Interceptors may not be correctly initialized
---
.../ws/security/wss4j/WSS4JStaxInInterceptor.java | 3 ++
.../ws/security/wss4j/WSS4JStaxOutInterceptor.java | 3 ++
.../org/apache/cxf/systest/ws/fault/FaultTest.java | 36 ++++++++++++++++++++++
3 files changed, 42 insertions(+)
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JStaxInInterceptor.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JStaxInInterceptor.java
index a5fc659..33e1b69 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JStaxInInterceptor.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JStaxInInterceptor.java
@@ -74,18 +74,21 @@ public class WSS4JStaxInInterceptor extends AbstractWSS4JStaxInterceptor {
public WSS4JStaxInInterceptor(WSSSecurityProperties securityProperties) {
super(securityProperties);
+ WSSec.init();
setPhase(Phase.POST_STREAM);
getAfter().add(StaxInInterceptor.class.getName());
}
public WSS4JStaxInInterceptor(Map<String, Object> props) {
super(props);
+ WSSec.init();
setPhase(Phase.POST_STREAM);
getAfter().add(StaxInInterceptor.class.getName());
}
public WSS4JStaxInInterceptor() {
super();
+ WSSec.init();
setPhase(Phase.POST_STREAM);
getAfter().add(StaxInInterceptor.class.getName());
}
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JStaxOutInterceptor.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JStaxOutInterceptor.java
index 331bd46..69c4e9b 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JStaxOutInterceptor.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JStaxOutInterceptor.java
@@ -69,6 +69,7 @@ public class WSS4JStaxOutInterceptor extends AbstractWSS4JStaxInterceptor {
public WSS4JStaxOutInterceptor(WSSSecurityProperties securityProperties) {
super(securityProperties);
+ WSSec.init();
setPhase(Phase.PRE_STREAM);
getBefore().add(StaxOutInterceptor.class.getName());
@@ -77,6 +78,7 @@ public class WSS4JStaxOutInterceptor extends AbstractWSS4JStaxInterceptor {
public WSS4JStaxOutInterceptor(Map<String, Object> props) {
super(props);
+ WSSec.init();
setPhase(Phase.PRE_STREAM);
getBefore().add(StaxOutInterceptor.class.getName());
getAfter().add("org.apache.cxf.interceptor.LoggingOutInterceptor");
@@ -86,6 +88,7 @@ public class WSS4JStaxOutInterceptor extends AbstractWSS4JStaxInterceptor {
public WSS4JStaxOutInterceptor() {
super();
+ WSSec.init();
setPhase(Phase.PRE_STREAM);
getBefore().add(StaxOutInterceptor.class.getName());
getAfter().add("org.apache.cxf.interceptor.LoggingOutInterceptor");
diff --git a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/FaultTest.java b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/FaultTest.java
index 6f90606..bad234d 100644
--- a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/FaultTest.java
+++ b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/FaultTest.java
@@ -104,6 +104,42 @@ public class FaultTest extends AbstractBusClientServerTestBase {
}
@org.junit.Test
+ public void testSoap11StAX() throws Exception {
+
+ SpringBusFactory bf = new SpringBusFactory();
+ URL busFile = FaultTest.class.getResource("client.xml");
+
+ Bus bus = bf.createBus(busFile.toString());
+ BusFactory.setDefaultBus(bus);
+ BusFactory.setThreadDefaultBus(bus);
+
+ URL wsdl = FaultTest.class.getResource("DoubleItFault.wsdl");
+ Service service = Service.create(wsdl, SERVICE_QNAME);
+ QName portQName = new QName(NAMESPACE, "DoubleItSoap11Port");
+ DoubleItPortType utPort =
+ service.getPort(portQName, DoubleItPortType.class);
+ updateAddressPort(utPort, PORT);
+
+ // Make a successful invocation
+ SecurityTestUtil.enableStreaming(utPort);
+ ((BindingProvider)utPort).getRequestContext().put(SecurityConstants.USERNAME, "alice");
+ utPort.doubleIt(25);
+/*
+ // Now make an invocation using another username
+ ((BindingProvider)utPort).getRequestContext().put(SecurityConstants.USERNAME, "bob");
+ ((BindingProvider)utPort).getRequestContext().put("security.password", "password");
+ try {
+ utPort.doubleIt(25);
+ fail("Expected failure on bob");
+ } catch (Exception ex) {
+ assertTrue(ex.getMessage().contains("This is a fault"));
+ }
+*/
+ ((java.io.Closeable)utPort).close();
+ bus.shutdown(true);
+ }
+
+ @org.junit.Test
public void testSoap12() throws Exception {
SpringBusFactory bf = new SpringBusFactory();
URL busFile = FaultTest.class.getResource("client.xml");
--
To stop receiving notification emails like this one, please contact
['"commits@cxf.apache.org" <co...@cxf.apache.org>'].