cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r897954 - in /cxf/branches/2.2.x-fixes: ./ rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/
Date Mon, 11 Jan 2010 17:21:26 GMT
Author: dkulp
Date: Mon Jan 11 17:21:26 2010
New Revision: 897954

URL: http://svn.apache.org/viewvc?rev=897954&view=rev
Log:
Merged revisions 897613 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r897613 | cschneider | 2010-01-10 06:03:51 -0500 (Sun, 10 Jan 2010) | 1 line
  
  Fix CXF-2459 set SecurityContext in jms transport for Tibco EMS
........

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
    cxf/branches/2.2.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
    cxf/branches/2.2.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
    cxf/branches/2.2.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSUtils.java

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.2.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java?rev=897954&r1=897953&r2=897954&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
Mon Jan 11 17:21:26 2010
@@ -289,7 +289,8 @@
         exchange.setInMessage(inMessage);
         LOG.log(Level.FINE, "client received reply: ", jmsMessage);
         try {
-            JMSUtils.populateIncomingContext(jmsMessage, inMessage, JMSConstants.JMS_CLIENT_RESPONSE_HEADERS);
+            JMSUtils.populateIncomingContext(jmsMessage, inMessage, 
+                                             JMSConstants.JMS_CLIENT_RESPONSE_HEADERS, jmsConfig);
         
             byte[] response = JMSUtils.retrievePayload(jmsMessage, (String)inMessage.get(Message.ENCODING));
             LOG.log(Level.FINE, "The Response Message payload is : [" + response + "]");

Modified: cxf/branches/2.2.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java?rev=897954&r1=897953&r2=897954&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
Mon Jan 11 17:21:26 2010
@@ -88,6 +88,7 @@
     private String cacheLevelName;
     private boolean enforceSpec = true;
     private boolean acceptMessagesWhileStopping;
+    private boolean jmsProviderTibcoEms;
 
     private ConnectionFactory wrappedConnectionFactory;
     
@@ -493,4 +494,17 @@
     public void setMessageListenerContainer(AbstractMessageListenerContainer messageListenerContainer)
{
         this.messageListenerContainer = messageListenerContainer;
     }
+
+    /** * @return Returns the jmsProviderTibcoEms.
+     */
+    public boolean isJmsProviderTibcoEms() {
+        return jmsProviderTibcoEms;
+    }
+
+    /**
+     * @param jmsProviderTibcoEms The jmsProviderTibcoEms to set.
+     */
+    public void setJmsProviderTibcoEms(boolean jmsProviderTibcoEms) {
+        this.jmsProviderTibcoEms = jmsProviderTibcoEms;
+    }
 }

Modified: cxf/branches/2.2.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java?rev=897954&r1=897953&r2=897954&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
Mon Jan 11 17:21:26 2010
@@ -185,7 +185,8 @@
             getLogger().log(Level.FINE, "server received request: ", message);
              // Build CXF message from JMS message
             MessageImpl inMessage = new MessageImpl();            
-            JMSUtils.populateIncomingContext(message, inMessage, JMSConstants.JMS_SERVER_REQUEST_HEADERS);
+            JMSUtils.populateIncomingContext(message, inMessage, 
+                                             JMSConstants.JMS_SERVER_REQUEST_HEADERS, jmsConfig);
             
             byte[] request = JMSUtils.retrievePayload(message, (String)inMessage.get(Message.ENCODING));
             getLogger().log(Level.FINE, "The Request Message is [ " + request + "]");

Modified: cxf/branches/2.2.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSUtils.java?rev=897954&r1=897953&r2=897954&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSUtils.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSUtils.java
Mon Jan 11 17:21:26 2010
@@ -134,7 +134,8 @@
     }
 
     public static void populateIncomingContext(javax.jms.Message message,
-                                               org.apache.cxf.message.Message inMessage,
String headerType)
+                                               org.apache.cxf.message.Message inMessage,

+                                               String headerType, JMSConfiguration jmsConfig)
         throws UnsupportedEncodingException {
         try {
             JMSMessageHeadersType headers = null;
@@ -183,7 +184,7 @@
             }
             inMessage.put(org.apache.cxf.message.Message.PROTOCOL_HEADERS, protHeaders);
 
-            SecurityContext securityContext = buildSecurityContext(message);
+            SecurityContext securityContext = buildSecurityContext(message, jmsConfig);
             inMessage.put(SecurityContext.class, securityContext);
         } catch (JMSException ex) {
             throw JmsUtils.convertJmsAccessException(ex);
@@ -191,7 +192,8 @@
     }
 
     /**
-     * Extract the property JMSXUserID from the jms message and create a SecurityContext
from it. 
+     * Extract the property JMSXUserID or JMS_TIBCO_SENDER from the jms message and 
+     * create a SecurityContext from it. 
      * For more info see Jira Issue CXF-2055
      * {@link https://issues.apache.org/jira/browse/CXF-2055}
      * 
@@ -199,11 +201,17 @@
      * @return SecurityContext that contains the user of the producer of the message as the
Principal
      * @throws JMSException if something goes wrong
      */
-    private static SecurityContext buildSecurityContext(javax.jms.Message message) throws
JMSException {
-        final String jmsUserName = message.getStringProperty("JMSXUserID");
-        if (jmsUserName == null) {
+    private static SecurityContext buildSecurityContext(javax.jms.Message message, 
+                                                        JMSConfiguration config) throws JMSException
{
+        String tempUserName = message.getStringProperty("JMSXUserID");
+        if (tempUserName == null && config.isJmsProviderTibcoEms()) {
+            tempUserName = message.getStringProperty("JMS_TIBCO_SENDER");
+        }
+        if (tempUserName == null) {
             return null;
         }
+        final String jmsUserName = tempUserName;
+
         final Principal principal = new Principal() {
             public String getName() {
                 return jmsUserName;



Mime
View raw message