Repository: cxf Updated Branches: refs/heads/3.1.x-fixes 7923a6209 -> e7d7190b8
Fix SAML Audience Restriction problem with JMS Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/e7d7190b Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/e7d7190b Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/e7d7190b Branch: refs/heads/3.1.x-fixes Commit: e7d7190b89ecf2ab9bd100ede621ebd6a2808dcd Parents: 7923a62 Author: Colm O hEigeartaigh <[email protected]> Authored: Wed Nov 11 10:58:29 2015 +0000 Committer: Colm O hEigeartaigh <[email protected]> Committed: Wed Nov 11 11:06:46 2015 +0000 ---------------------------------------------------------------------- .../main/java/org/apache/cxf/transport/jms/JMSMessageUtils.java | 4 +++- .../org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java | 2 +- .../org/apache/cxf/systest/jms/security/JMSWSSecurityTest.java | 3 +-- 3 files changed, 5 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/e7d7190b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSMessageUtils.java ---------------------------------------------------------------------- diff --git a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSMessageUtils.java b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSMessageUtils.java index 0c61622..3975b63 100644 --- a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSMessageUtils.java +++ b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSMessageUtils.java @@ -154,7 +154,6 @@ final class JMSMessageUtils { inMessage.put(org.apache.cxf.message.Message.PROTOCOL_HEADERS, protHeaders); populateIncomingMessageProperties(message, inMessage, messageProperties); - } /** @@ -209,6 +208,9 @@ final class JMSMessageUtils { headers.put(JMSSpecConstants.TARGET_SERVICE_IN_REQUESTURI, Collections.singletonList("true")); } + if (requestURI != null) { + inMessage.put(org.apache.cxf.message.Message.REQUEST_URI, requestURI); + } } catch (Exception e) { headers.put(JMSSpecConstants.MALFORMED_REQUESTURI, Collections.singletonList("true")); } http://git-wip-us.apache.org/repos/asf/cxf/blob/e7d7190b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java ---------------------------------------------------------------------- diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java index d78a069..20b70a5 100644 --- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java +++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java @@ -345,7 +345,7 @@ public class WSS4JInInterceptor extends AbstractWSS4JInterceptor { if (msg.get(org.apache.cxf.message.Message.REQUEST_URL) != null) { audiences.add((String)msg.get(org.apache.cxf.message.Message.REQUEST_URL)); } else if (msg.get(org.apache.cxf.message.Message.REQUEST_URI) != null) { - audiences.add((String)msg.get(org.apache.cxf.message.Message.REQUEST_URL)); + audiences.add((String)msg.get(org.apache.cxf.message.Message.REQUEST_URI)); } if (msg.getContextualProperty("javax.xml.ws.wsdl.service") != null) { http://git-wip-us.apache.org/repos/asf/cxf/blob/e7d7190b/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/security/JMSWSSecurityTest.java ---------------------------------------------------------------------- diff --git a/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/security/JMSWSSecurityTest.java b/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/security/JMSWSSecurityTest.java index 6db3729..fc8ffb2 100644 --- a/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/security/JMSWSSecurityTest.java +++ b/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/security/JMSWSSecurityTest.java @@ -112,7 +112,6 @@ public class JMSWSSecurityTest extends AbstractBusClientServerTestBase { } @Test - @org.junit.Ignore public void testUnsignedSAML2AudienceRestrictionToken() throws Exception { QName serviceName = new QName("http://cxf.apache.org/hello_world_jms", "HelloWorldService"); QName portName = new QName("http://cxf.apache.org/hello_world_jms", "HelloWorldPort"); @@ -129,7 +128,7 @@ public class JMSWSSecurityTest extends AbstractBusClientServerTestBase { ConditionsBean conditions = new ConditionsBean(); conditions.setTokenPeriodMinutes(5); List<String> audiences = new ArrayList<>(); - audiences.add("http://apache.org/one"); + audiences.add("jms:jndi:dynamicQueues/test.jmstransport.text"); AudienceRestrictionBean audienceRestrictionBean = new AudienceRestrictionBean(); audienceRestrictionBean.setAudienceURIs(audiences); conditions.setAudienceRestrictions(Collections.singletonList(audienceRestrictionBean));
