cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r688868 - in /cxf/trunk: api/src/main/java/org/apache/cxf/ws/policy/ rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/ rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/in...
Date Mon, 25 Aug 2008 20:42:55 GMT
Author: dkulp
Date: Mon Aug 25 13:42:54 2008
New Revision: 688868

URL: http://svn.apache.org/viewvc?rev=688868&view=rev
Log:
Bunch more policy refactory to get nested policies asserted and their interceptors added

Modified:
    cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionInfo.java
    cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionInfoMap.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInFaultInterceptor.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInInterceptor.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyOutInterceptor.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EffectivePolicyImpl.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EndpointPolicyImpl.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyInInterceptor.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutFaultInterceptor.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutInterceptor.java
    cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EffectivePolicyImplTest.java
    cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EndpointPolicyImplTest.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/WSSecurityInterceptorProvider.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/WSSecurityPolicyInterceptorProvider.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TransportBinding.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/AbstractWSS4JInterceptor.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JOutInterceptor.java

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionInfo.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionInfo.java?rev=688868&r1=688867&r2=688868&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionInfo.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionInfo.java Mon Aug 25 13:42:54
2008
@@ -40,4 +40,7 @@
     public PolicyAssertion getAssertion() {
         return assertion;
     }
+    public String toString() {
+        return assertion.getName() + ":" + asserted;
+    }
 }

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionInfoMap.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionInfoMap.java?rev=688868&r1=688867&r2=688868&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionInfoMap.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionInfoMap.java Mon Aug 25
13:42:54 2008
@@ -45,7 +45,7 @@
     }
     
     public AssertionInfoMap(Collection<PolicyAssertion> assertions) {
-        super(assertions.size());
+        super(assertions.size() < 6 ? 6 : assertions.size());
         for (PolicyAssertion a : assertions) {
             putAssertionInfo(a);
         }
@@ -74,15 +74,32 @@
 
     }
     
-    public boolean supportsAlternative(Collection<PolicyAssertion> alternative,
+    public boolean supportsAlternative(PolicyAssertion assertion,
                                        List<QName> errors) {
         boolean pass = true;
-        for (PolicyAssertion a : alternative) {          
-            if (!a.isAsserted(this)) {
-                errors.add(a.getName());
-                pass = false;
+        PolicyAssertion a = (PolicyAssertion)assertion;
+        if (!a.isAsserted(this) && !a.isOptional()) {
+            errors.add(a.getName());
+            pass = false;
+        }
+        Policy p = a.getPolicy();
+        if (p != null) {
+            Iterator it = p.getAlternatives();
+            while (it.hasNext()) {
+                List<PolicyAssertion> lst = CastUtils.cast((List<?>)it.next());
+                for (PolicyAssertion p2 : lst) {
+                    pass &= supportsAlternative(p2, errors);
+                }
             }
         }
+        return pass || a.isOptional();
+    }
+    public boolean supportsAlternative(Collection<PolicyAssertion> alternative,
+                                       List<QName> errors) {
+        boolean pass = true;
+        for (PolicyAssertion a : alternative) {
+            pass &= supportsAlternative(a, errors);
+        }
         return pass;
     }
     

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInFaultInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInFaultInterceptor.java?rev=688868&r1=688867&r2=688868&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInFaultInterceptor.java
(original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInFaultInterceptor.java
Mon Aug 25 13:42:54 2008
@@ -79,7 +79,7 @@
         LOG.fine("faultInterceptors: " + faultInterceptors);
         for (Interceptor i : faultInterceptors) {
             msg.getInterceptorChain().add(i);
-            LOG.log(Level.INFO, "Added interceptor of type {0}", i.getClass().getSimpleName());
+            LOG.log(Level.FINE, "Added interceptor of type {0}", i.getClass().getSimpleName());
         }
         
         // insert assertions of endpoint's fault vocabulary into message

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInInterceptor.java?rev=688868&r1=688867&r2=688868&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInInterceptor.java
(original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInInterceptor.java
Mon Aug 25 13:42:54 2008
@@ -76,7 +76,7 @@
         List<Interceptor> interceptors = ep.getInterceptors();
         for (Interceptor i : interceptors) {
             msg.getInterceptorChain().add(i);
-            LOG.log(Level.INFO, "Added interceptor of type {0}", i.getClass().getSimpleName());
           
+            LOG.log(Level.FINE, "Added interceptor of type {0}", i.getClass().getSimpleName());
           
         }
         
         // insert assertions of endpoint's vocabulary into message

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyOutInterceptor.java?rev=688868&r1=688867&r2=688868&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyOutInterceptor.java
(original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyOutInterceptor.java
Mon Aug 25 13:42:54 2008
@@ -84,7 +84,7 @@
         List<Interceptor> interceptors = effectivePolicy.getInterceptors();
         for (Interceptor i : interceptors) {            
             msg.getInterceptorChain().add(i);
-            LOG.log(Level.INFO, "Added interceptor of type {0}", i.getClass().getSimpleName());
+            LOG.log(Level.FINE, "Added interceptor of type {0}", i.getClass().getSimpleName());
         }
         
         // insert assertions of the chosen alternative into the message

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EffectivePolicyImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EffectivePolicyImpl.java?rev=688868&r1=688867&r2=688868&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EffectivePolicyImpl.java
(original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EffectivePolicyImpl.java
Mon Aug 25 13:42:54 2008
@@ -21,8 +21,11 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.ResourceBundle;
+import java.util.Set;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -31,6 +34,7 @@
 import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.interceptor.Interceptor;
 import org.apache.cxf.service.model.BindingFaultInfo;
 import org.apache.cxf.service.model.BindingMessageInfo;
@@ -130,18 +134,41 @@
     void initialiseInterceptors(PolicyEngineImpl engine) {
         PolicyInterceptorProviderRegistry reg 
             = engine.getBus().getExtension(PolicyInterceptorProviderRegistry.class);
-        List<Interceptor> out = new ArrayList<Interceptor>();
+        Set<Interceptor> out = new LinkedHashSet<Interceptor>();
         for (PolicyAssertion a : getChosenAlternative()) {
-            if (a.isOptional()) {
-                continue;
+            initialiseInterceptors(reg, engine, out, a);
+        }        
+        setInterceptors(new ArrayList<Interceptor>(out));
+    }
+    
+    
+    protected Collection<PolicyAssertion> getSupportedAlternatives(PolicyEngineImpl
engine,
+                                                                   Policy p) {
+        Collection<PolicyAssertion> alternatives = new ArrayList<PolicyAssertion>();
+        for (Iterator it = p.getAlternatives(); it.hasNext();) {
+            List<PolicyAssertion> alternative = CastUtils.cast((List)it.next(), PolicyAssertion.class);
+            if (engine.supportsAlternative(alternative, null)) {
+                alternatives.addAll(alternative);
             }
-            QName qn = a.getName();
-            PolicyInterceptorProvider pp = reg.get(qn);
-            if (null != pp) {
-                out.addAll(pp.getOutInterceptors());
+        }
+        return alternatives;
+    }
+
+    void initialiseInterceptors(PolicyInterceptorProviderRegistry reg,
+                                PolicyEngineImpl engine,
+                                Set<Interceptor> out,
+                                PolicyAssertion a) {
+        QName qn = a.getName();
+        PolicyInterceptorProvider pp = reg.get(qn);
+        if (null != pp) {
+            out.addAll(pp.getOutInterceptors());
+        }
+        Policy p = a.getPolicy();
+        if (p != null) {
+            for (PolicyAssertion a2 : getSupportedAlternatives(engine, p)) {
+                initialiseInterceptors(reg, engine, out, a2);
             }
         }
-        setInterceptors(out);
     }
     
     // for tests

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EndpointPolicyImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EndpointPolicyImpl.java?rev=688868&r1=688867&r2=688868&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EndpointPolicyImpl.java
(original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EndpointPolicyImpl.java
Mon Aug 25 13:42:54 2008
@@ -21,8 +21,8 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.HashSet;
 import java.util.Iterator;
+import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.ResourceBundle;
 import java.util.Set;
@@ -194,41 +194,54 @@
         }
     }
 
+    Collection<PolicyAssertion> getSupportedAlternatives(Policy p) {
+        Collection<PolicyAssertion> alternatives = new ArrayList<PolicyAssertion>();
+        for (Iterator it = p.getAlternatives(); it.hasNext();) {
+            List<PolicyAssertion> alternative = CastUtils.cast((List)it.next(), PolicyAssertion.class);
+            if (engine.supportsAlternative(alternative, null)) {
+                alternatives.addAll(alternative);
+            }
+        }
+        return alternatives;
+    }
+
+    void initializeInterceptors(PolicyInterceptorProviderRegistry reg,
+                                Set<Interceptor> out,
+                                PolicyAssertion a, 
+                                boolean fault) {
+        QName qn = a.getName();
+        PolicyInterceptorProvider pp = reg.get(qn);
+        if (null != pp) {
+            out.addAll(fault ? pp.getInFaultInterceptors() : pp.getInInterceptors());
+        }
+        Policy p = a.getPolicy();
+        if (p != null) {
+            for (PolicyAssertion a2 : getSupportedAlternatives(p)) {
+                initializeInterceptors(reg, out, a2, fault);
+            }
+        }
+    }
+
     void initializeInterceptors() {
         PolicyInterceptorProviderRegistry reg 
             = engine.getBus().getExtension(PolicyInterceptorProviderRegistry.class);
-        interceptors = new ArrayList<Interceptor>();
-        if (requestor) {
-            faultInterceptors = new ArrayList<Interceptor>();
-        }
         
-        Set<QName> v = new HashSet<QName>();
-        for (PolicyAssertion a : vocabulary) {
-            v.add(a.getName());
-        }
-        
-        for (QName qn : v) {
-            PolicyInterceptorProvider pp = reg.get(qn);
-            if (null != pp) {
-                interceptors.addAll(pp.getInInterceptors());
+        Set<Interceptor> out = new LinkedHashSet<Interceptor>();
+        if (getChosenAlternative() != null) {
+            for (PolicyAssertion a : getChosenAlternative()) {
+                initializeInterceptors(reg, out, a, false);
             }
         }
-        
+        interceptors = new ArrayList<Interceptor>(out);
+
         if (!requestor) {
             return;
         }
-        
-        Set<QName> faultV = new HashSet<QName>();
-        for (PolicyAssertion a : faultVocabulary) {
-            faultV.add(a.getName());
+        out.clear();
+        for (PolicyAssertion a : getChosenAlternative()) {
+            initializeInterceptors(reg, out, a, true);
         }
-        
-        for (QName qn : faultV) {
-            PolicyInterceptorProvider pp = reg.get(qn);
-            if (null != pp) {
-                faultInterceptors.addAll(pp.getInFaultInterceptors());
-            }
-        }        
+        faultInterceptors = new ArrayList<Interceptor>(out);
     }
     
     // for test

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyInInterceptor.java?rev=688868&r1=688867&r2=688868&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyInInterceptor.java
(original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyInInterceptor.java
Mon Aug 25 13:42:54 2008
@@ -76,7 +76,7 @@
         List<Interceptor> interceptors = ep.getInterceptors();
         for (Interceptor i : interceptors) {
             msg.getInterceptorChain().add(i);
-            LOG.log(Level.INFO, "Added interceptor of type {0}", i.getClass().getSimpleName());
+            LOG.log(Level.FINE, "Added interceptor of type {0}", i.getClass().getSimpleName());
         }
         
         // insert assertions of endpoint's vocabulary into message

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutFaultInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutFaultInterceptor.java?rev=688868&r1=688867&r2=688868&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutFaultInterceptor.java
(original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutFaultInterceptor.java
Mon Aug 25 13:42:54 2008
@@ -90,7 +90,7 @@
         List<Interceptor> interceptors = effectivePolicy.getInterceptors();
         for (Interceptor oi : interceptors) {
             msg.getInterceptorChain().add(oi);
-            LOG.log(Level.INFO, "Added interceptor of type {0}", oi.getClass().getSimpleName());
+            LOG.log(Level.FINE, "Added interceptor of type {0}", oi.getClass().getSimpleName());
         }
         
         // insert assertions of the chosen alternative into the message

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutInterceptor.java?rev=688868&r1=688867&r2=688868&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutInterceptor.java
(original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutInterceptor.java
Mon Aug 25 13:42:54 2008
@@ -80,7 +80,7 @@
         List<Interceptor> interceptors = effectivePolicy.getInterceptors();
         for (Interceptor oi : interceptors) {
             msg.getInterceptorChain().add(oi);
-            LOG.log(Level.INFO, "Added interceptor of type {0}", oi.getClass().getSimpleName());
          
+            LOG.log(Level.FINE, "Added interceptor of type {0}", oi.getClass().getSimpleName());
          
         }
         
         // insert assertions of the chosen alternative into the message

Modified: cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EffectivePolicyImplTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EffectivePolicyImplTest.java?rev=688868&r1=688867&r2=688868&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EffectivePolicyImplTest.java
(original)
+++ cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EffectivePolicyImplTest.java
Mon Aug 25 13:42:54 2008
@@ -274,7 +274,6 @@
         setupPolicyInterceptorProviderRegistry(engine, reg);
         PolicyAssertion a = control.createMock(PolicyAssertion.class);        
         alternative.add(a);
-        EasyMock.expect(a.isOptional()).andReturn(true);
         control.replay();
         epi.initialiseInterceptors(engine);
         assertEquals(0, epi.getInterceptors().size());
@@ -282,7 +281,6 @@
         
         control.reset();
         setupPolicyInterceptorProviderRegistry(engine, reg);
-        EasyMock.expect(a.isOptional()).andReturn(false);
         QName qn = new QName("http://x.y.z", "a");
         EasyMock.expect(a.getName()).andReturn(qn);
         EasyMock.expect(reg.get(qn)).andReturn(null);
@@ -293,7 +291,6 @@
         
         control.reset();
         setupPolicyInterceptorProviderRegistry(engine, reg);
-        EasyMock.expect(a.isOptional()).andReturn(false);
         EasyMock.expect(a.getName()).andReturn(qn);        
         PolicyInterceptorProvider pp = control.createMock(PolicyInterceptorProvider.class);
              
         EasyMock.expect(reg.get(qn)).andReturn(pp);

Modified: cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EndpointPolicyImplTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EndpointPolicyImplTest.java?rev=688868&r1=688867&r2=688868&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EndpointPolicyImplTest.java
(original)
+++ cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EndpointPolicyImplTest.java
Mon Aug 25 13:42:54 2008
@@ -346,19 +346,20 @@
         v.add(mockAssertion(aqn, requestor ? 2 : 1, false));
         fv.addAll(v);
         epi.setVocabulary(v);
+        epi.setChosenAlternative(v);
         epi.setFaultVocabulary(fv);
         
         PolicyInterceptorProviderRegistry reg = control.createMock(PolicyInterceptorProviderRegistry.class);
         setupPolicyInterceptorProviderRegistry(engine, reg);
         
         PolicyInterceptorProvider app = control.createMock(PolicyInterceptorProvider.class);
              
-        EasyMock.expect(reg.get(aqn)).andReturn(app).times(requestor ? 2 : 1);
+        EasyMock.expect(reg.get(aqn)).andReturn(app).anyTimes();
         Interceptor api = control.createMock(Interceptor.class);
         EasyMock.expect(app.getInInterceptors())
-            .andReturn(Collections.singletonList(api));
+            .andReturn(Collections.singletonList(api)).anyTimes();
         if (requestor) {
             EasyMock.expect(app.getInFaultInterceptors())
-                .andReturn(Collections.singletonList(api));
+                .andReturn(Collections.singletonList(api)).anyTimes();
         }
         
         control.replay();

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/WSSecurityInterceptorProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/WSSecurityInterceptorProvider.java?rev=688868&r1=688867&r2=688868&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/WSSecurityInterceptorProvider.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/WSSecurityInterceptorProvider.java
Mon Aug 25 13:42:54 2008
@@ -52,6 +52,9 @@
         ASSERTION_TYPES.add(SP12Constants.WSS11);
         ASSERTION_TYPES.add(SP12Constants.SIGNED_SUPPORTING_TOKENS);
         ASSERTION_TYPES.add(SP12Constants.USERNAME_TOKEN);
+        
+        ASSERTION_TYPES.add(SP11Constants.TRANSPORT_BINDING);
+        ASSERTION_TYPES.add(SP12Constants.TRANSPORT_BINDING);
 
     }
 

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/WSSecurityPolicyInterceptorProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/WSSecurityPolicyInterceptorProvider.java?rev=688868&r1=688867&r2=688868&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/WSSecurityPolicyInterceptorProvider.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/WSSecurityPolicyInterceptorProvider.java
Mon Aug 25 13:42:54 2008
@@ -35,9 +35,9 @@
     private static final Collection<QName> ASSERTION_TYPES;
     static {
         ASSERTION_TYPES = new ArrayList<QName>();
-        ASSERTION_TYPES.add(SP11Constants.TRANSPORT_BINDING);
+        //ASSERTION_TYPES.add(SP11Constants.TRANSPORT_BINDING);
+        //ASSERTION_TYPES.add(SP12Constants.TRANSPORT_BINDING);
         ASSERTION_TYPES.add(SP11Constants.TRANSPORT_TOKEN);
-        ASSERTION_TYPES.add(SP12Constants.TRANSPORT_BINDING);
         ASSERTION_TYPES.add(SP12Constants.TRANSPORT_TOKEN);
     }
 

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TransportBinding.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TransportBinding.java?rev=688868&r1=688867&r2=688868&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TransportBinding.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TransportBinding.java
Mon Aug 25 13:42:54 2008
@@ -124,12 +124,38 @@
         writer.writeEndElement();
 
     }
-    public PolicyComponent normalize() {        
+    public PolicyComponent normalize() {
+        return this;
+        /*
         Policy p = new Policy();
         ExactlyOne ea = new ExactlyOne();
         p.addPolicyComponent(ea);
         All all = new All();
+        if (transportToken != null) {
+            all.addPolicyComponent(transportToken);
+        }
+        if (isIncludeTimestamp()) {
+            all.addPolicyComponent(new PrimitiveAssertion(SP12Constants.INCLUDE_TIMESTAMP));
+        }
+        if (getLayout() != null) {
+            all.addPolicyComponent(getLayout());
+        }
         ea.addPolicyComponent(all);
+        PolicyComponent pc = p.normalize(true);
+        if (pc instanceof Policy) {
+            return new NestedPrimitiveAssertion(getName(), false, (Policy)pc, true);
+        } else {
+            p = new Policy();
+            p.addPolicyComponent(pc);
+            return new NestedPrimitiveAssertion(getName(), false, p, true);
+        }
+        */
+    }
+    public Policy getPolicy() {
+        Policy p = new Policy();
+        ExactlyOne ea = new ExactlyOne();
+        p.addPolicyComponent(ea);
+        All all = new All();
         if (transportToken != null) {
             all.addPolicyComponent(transportToken);
         }
@@ -139,7 +165,15 @@
         if (getLayout() != null) {
             all.addPolicyComponent(getLayout());
         }
+        ea.addPolicyComponent(all);
+        PolicyComponent pc = p.normalize(true);
+        if (pc instanceof Policy) {
+            return (Policy)pc;
+        } else {
+            p = new Policy();
+            p.addPolicyComponent(pc);
+            return p;
+        }
         
-        return p.normalize(true);
     }
 }

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/AbstractWSS4JInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/AbstractWSS4JInterceptor.java?rev=688868&r1=688867&r2=688868&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/AbstractWSS4JInterceptor.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/AbstractWSS4JInterceptor.java
Mon Aug 25 13:42:54 2008
@@ -172,6 +172,13 @@
                     }
                 }                    
             }
+            ais = aim.get(SP12Constants.TRANSPORT_BINDING);
+            if (ais != null) {
+                for (AssertionInfo ai : ais) {
+                    ai.setAsserted(true);
+                }                    
+            }
+
         }
     }
 

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JOutInterceptor.java?rev=688868&r1=688867&r2=688868&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JOutInterceptor.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JOutInterceptor.java
Mon Aug 25 13:42:54 2008
@@ -113,6 +113,12 @@
                         }
                     }                    
                 }
+                ais = aim.get(SP12Constants.TRANSPORT_BINDING);
+                if (ais != null) {
+                    for (AssertionInfo ai : ais) {
+                        ai.setAsserted(true);
+                    }                    
+                }
                 if (timestamp != null) {
                     timestamp.prependToHeader(secHeader);
                 }



Mime
View raw message