cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1562858 - in /cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security: policy/interceptors/SecureConversationInInterceptor.java tokenstore/SecurityToken.java
Date Thu, 30 Jan 2014 15:40:48 GMT
Author: coheigea
Date: Thu Jan 30 15:40:47 2014
New Revision: 1562858

URL: http://svn.apache.org/r1562858
Log:
[CXF-5533] - Store a reference to a Bootstrap SecurityToken in SecureConveration

Modified:
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/SecureConversationInInterceptor.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/tokenstore/SecurityToken.java

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/SecureConversationInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/SecureConversationInInterceptor.java?rev=1562858&r1=1562857&r2=1562858&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/SecureConversationInInterceptor.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/SecureConversationInInterceptor.java
Thu Jan 30 15:40:47 2014
@@ -23,11 +23,11 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Date;
 import java.util.List;
+import java.util.Properties;
 
 import javax.xml.namespace.QName;
 
 import org.w3c.dom.Element;
-
 import org.apache.cxf.binding.soap.SoapBindingConstants;
 import org.apache.cxf.binding.soap.SoapMessage;
 import org.apache.cxf.binding.soap.interceptor.SoapActionInInterceptor;
@@ -53,6 +53,7 @@ import org.apache.cxf.ws.security.trust.
 import org.apache.cxf.ws.security.trust.STSUtils;
 import org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor;
 import org.apache.cxf.ws.security.wss4j.WSS4JStaxInInterceptor;
+import org.apache.cxf.ws.security.wss4j.WSS4JUtils;
 import org.apache.neethi.All;
 import org.apache.neethi.Assertion;
 import org.apache.neethi.ExactlyOne;
@@ -352,6 +353,14 @@ class SecureConversationInInterceptor ex
                 token.setSecurityContext(sc);
             }
             
+            // Get Bootstrap Token
+            SecurityToken bootstrapToken = getBootstrapToken(exchange.getInMessage());
+            if (bootstrapToken != null) {
+                Properties properties = new Properties();
+                properties.put(SecurityToken.BOOTSTRAP_TOKEN_ID, bootstrapToken.getId());
+                token.setProperties(properties);
+            }
+            
             ((TokenStore)exchange.get(Endpoint.class).getEndpointInfo()
                     .getProperty(TokenStore.class.getName())).add(token);
             
@@ -362,6 +371,16 @@ class SecureConversationInInterceptor ex
             }
         }
 
+        private SecurityToken getBootstrapToken(Message message) {
+            SecurityToken st = (SecurityToken)message.getContextualProperty(SecurityConstants.TOKEN);
+            if (st == null) {
+                String id = (String)message.getContextualProperty(SecurityConstants.TOKEN_ID);
+                if (id != null) {
+                    st = WSS4JUtils.getTokenStore(message).getToken(id);
+                }
+            }
+            return st;
+        }
     }
     
     

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/tokenstore/SecurityToken.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/tokenstore/SecurityToken.java?rev=1562858&r1=1562857&r2=1562858&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/tokenstore/SecurityToken.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/tokenstore/SecurityToken.java
Thu Jan 30 15:40:47 2014
@@ -45,6 +45,11 @@ import org.apache.wss4j.dom.util.XmlSche
  */
 public class SecurityToken implements Serializable {
     
+    /**
+     * This tag holds an ID of a Bootstrap SecurityToken stored in the TokenStore 
+     */
+    public static final String BOOTSTRAP_TOKEN_ID = "bootstrap_security_token_id";
+    
     private static final long serialVersionUID = 3820740387121650613L;
 
     /**



Mime
View raw message