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 2015/11/11 11:59:26 UTC

cxf git commit: Fix SAML Audience Restriction problem with JMS

Repository: cxf
Updated Branches:
  refs/heads/master beb16984a -> 51afdb8aa


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/51afdb8a
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/51afdb8a
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/51afdb8a

Branch: refs/heads/master
Commit: 51afdb8aab284ba708c4aee8145c75af55af8701
Parents: beb1698
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Wed Nov 11 10:58:29 2015 +0000
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Wed Nov 11 10:58:29 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/51afdb8a/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/51afdb8a/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/51afdb8a/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));