cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1506891 - in /cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j: PolicyBasedWSS4JStaxInInterceptor.java WSS4JStaxInInterceptor.java
Date Thu, 25 Jul 2013 11:17:44 GMT
Author: coheigea
Date: Thu Jul 25 11:17:43 2013
New Revision: 1506891

URL: http://svn.apache.org/r1506891
Log:
Don't catch PolicyInputProcessor SecurityEvents

Modified:
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JStaxInInterceptor.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JStaxInInterceptor.java

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JStaxInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JStaxInInterceptor.java?rev=1506891&r1=1506890&r2=1506891&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JStaxInInterceptor.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JStaxInInterceptor.java
Thu Jul 25 11:17:43 2013
@@ -28,7 +28,6 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Properties;
 import java.util.logging.Logger;
@@ -389,15 +388,19 @@ public class PolicyBasedWSS4JStaxInInter
     }
     
     @Override
-    protected SecurityEventListener configureSecurityEventListener(
+    protected List<SecurityEventListener> configureSecurityEventListeners(
         SoapMessage msg, WSSSecurityProperties securityProperties
     ) throws WSSPolicyException {
+        List<SecurityEventListener> securityEventListeners = new ArrayList<SecurityEventListener>(2);
+        securityEventListeners.addAll(super.configureSecurityEventListeners(msg, securityProperties));
+        
         Endpoint endoint = msg.getExchange().get(Endpoint.class);
         
         PolicyEnforcer policyEnforcer = createPolicyEnforcer(endoint.getEndpointInfo(), msg);
         securityProperties.addInputProcessor(new PolicyInputProcessor(policyEnforcer, securityProperties));
-
-        return policyEnforcer;
+        securityEventListeners.add(policyEnforcer);
+        
+        return securityEventListeners;
     }
     
     private PolicyEnforcer createPolicyEnforcer(
@@ -457,21 +460,7 @@ public class PolicyBasedWSS4JStaxInInter
         }
         
         String actor = (String)msg.getContextualProperty(SecurityConstants.ACTOR);
-        final List<SecurityEvent> incomingSecurityEventList = new LinkedList<SecurityEvent>();
-        PolicyEnforcer securityEventListener = 
-            new PolicyEnforcer(operationPolicies, soapAction, isRequestor(msg), actor) {
-            
-                @Override
-                public void registerSecurityEvent(SecurityEvent securityEvent) throws WSSecurityException
{
-                    incomingSecurityEventList.add(securityEvent);
-                    super.registerSecurityEvent(securityEvent);
-                }
-            };
-        
-        msg.getExchange().put(SecurityEvent.class.getName() + ".in", incomingSecurityEventList);
-        msg.put(SecurityEvent.class.getName() + ".in", incomingSecurityEventList);
-        
-        return securityEventListener;
+        return new PolicyEnforcer(operationPolicies, soapAction, isRequestor(msg), actor);
     }
     
 }

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JStaxInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JStaxInInterceptor.java?rev=1506891&r1=1506890&r2=1506891&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JStaxInInterceptor.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JStaxInInterceptor.java
Thu Jul 25 11:17:43 2013
@@ -20,6 +20,7 @@ package org.apache.cxf.ws.security.wss4j
 
 import java.io.IOException;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
@@ -138,13 +139,13 @@ public class WSS4JStaxInInterceptor exte
 
             setTokenValidators(secProps, soapMessage);
             
-            SecurityEventListener securityEventListener = 
-                configureSecurityEventListener(soapMessage, secProps);
+            List<SecurityEventListener> securityEventListeners = 
+                configureSecurityEventListeners(soapMessage, secProps);
             
             inboundWSSec = WSSec.getInboundWSSec(secProps);
             
             newXmlStreamReader = 
-                inboundWSSec.processInMessage(originalXmlStreamReader, requestSecurityEvents,
securityEventListener);
+                inboundWSSec.processInMessage(originalXmlStreamReader, requestSecurityEvents,
securityEventListeners);
             soapMessage.setContent(XMLStreamReader.class, newXmlStreamReader);
 
             // Warning: The exceptions which can occur here are not security relevant exceptions
@@ -162,7 +163,7 @@ public class WSS4JStaxInInterceptor exte
         }
     }
     
-    protected SecurityEventListener configureSecurityEventListener(
+    protected List<SecurityEventListener> configureSecurityEventListeners(
         SoapMessage msg, WSSSecurityProperties securityProperties
     ) throws WSSPolicyException {
         final List<SecurityEvent> incomingSecurityEventList = new LinkedList<SecurityEvent>();
@@ -175,7 +176,7 @@ public class WSS4JStaxInInterceptor exte
         msg.getExchange().put(SecurityEvent.class.getName() + ".in", incomingSecurityEventList);
         msg.put(SecurityEvent.class.getName() + ".in", incomingSecurityEventList);
         
-        return securityEventListener;
+        return Collections.singletonList(securityEventListener);
     }
     
     protected void configureProperties(SoapMessage msg) throws WSSecurityException {



Mime
View raw message