cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschnei...@apache.org
Subject svn commit: r897613 - in /cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms: JMSConduit.java JMSConfiguration.java JMSDestination.java JMSUtils.java
Date Sun, 10 Jan 2010 11:03:52 GMT
Author: cschneider
Date: Sun Jan 10 11:03:51 2010
New Revision: 897613

URL: http://svn.apache.org/viewvc?rev=897613&view=rev
Log:
Fix CXF-2459 set SecurityContext in jms transport for Tibco EMS

Modified:
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSUtils.java

Modified: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java?rev=897613&r1=897612&r2=897613&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
(original)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
Sun Jan 10 11:03:51 2010
@@ -350,7 +350,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);
         
             JMSUtils.retrieveAndSetPayload(inMessage, jmsMessage, (String)inMessage.get(Message.ENCODING));
 

Modified: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java?rev=897613&r1=897612&r2=897613&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
(original)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
Sun Jan 10 11:03:51 2010
@@ -88,6 +88,7 @@
     private String cacheLevelName;
     private Boolean enforceSpec;
     private boolean acceptMessagesWhileStopping;
+    private boolean jmsProviderTibcoEms;
 
     //For jms spec.
     private String targetService;
@@ -527,4 +528,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/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java?rev=897613&r1=897612&r2=897613&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
(original)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
Sun Jan 10 11:03:51 2010
@@ -180,7 +180,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);
             
             JMSUtils.retrieveAndSetPayload(inMessage, message, (String)inMessage.get(Message.ENCODING));
             inMessage.put(JMSConstants.JMS_SERVER_RESPONSE_HEADERS, new JMSMessageHeadersType());

Modified: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSUtils.java?rev=897613&r1=897612&r2=897613&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSUtils.java (original)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSUtils.java Sun
Jan 10 11:03:51 2010
@@ -163,7 +163,8 @@
     }
 
     public static void populateIncomingContext(javax.jms.Message message,
-                                               org.apache.cxf.message.Message inMessage,
String messageType)
+                                               org.apache.cxf.message.Message inMessage,

+                                               String messageType, JMSConfiguration jmsConfig)
         throws UnsupportedEncodingException {
         try {
             JMSMessageHeadersType messageProperties = null;
@@ -212,7 +213,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);
 
             populateIncomingMessageProperties(message, inMessage, messageProperties);
@@ -285,7 +286,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}
      * 
@@ -293,11 +295,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