cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1445307 - in /cxf/trunk: rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builder/primitive/ rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/ rt/ws/security/src/main/ja...
Date Tue, 12 Feb 2013 18:47:38 GMT
Author: dkulp
Date: Tue Feb 12 18:47:36 2013
New Revision: 1445307

URL: http://svn.apache.org/r1445307
Log:
[CXF-4814] Better selection of alternatives for outgoing response

Modified:
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/WSPolicyFeature.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertion.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SP12Constants.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/AsymmetricBinding.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SymmetricBinding.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TransportBinding.java
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/algsuite/AlgorithmSuiteTest.java

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/WSPolicyFeature.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/WSPolicyFeature.java?rev=1445307&r1=1445306&r2=1445307&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/WSPolicyFeature.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/WSPolicyFeature.java Tue
Feb 12 18:47:36 2013
@@ -34,6 +34,7 @@ import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.feature.AbstractFeature;
+import org.apache.cxf.service.model.DescriptionInfo;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.ws.policy.attachment.external.ExternalAttachmentProvider;
 import org.apache.cxf.ws.policy.attachment.reference.ReferenceResolver;
@@ -136,7 +137,7 @@ public class WSPolicyFeature extends Abs
     private Policy initializeEndpointPolicy(Endpoint endpoint, Bus bus) {
         
         initialize(bus);
-        
+        DescriptionInfo i = endpoint.getEndpointInfo().getDescription();
         Collection<Policy> loadedPolicies = null;
         if (policyElements != null || policyReferenceElements != null) {
             loadedPolicies = new ArrayList<Policy>();
@@ -149,7 +150,7 @@ public class WSPolicyFeature extends Abs
             if (null != policyReferenceElements) {
                 for (Element e : policyReferenceElements) {
                     PolicyReference pr = builder.getPolicyReference(e);
-                    Policy resolved = resolveReference(pr, e, builder, bus);
+                    Policy resolved = resolveReference(pr, builder, bus, i);
                     if (null != resolved) {
                         loadedPolicies.add(resolved);
                     }
@@ -216,12 +217,12 @@ public class WSPolicyFeature extends Abs
         alternativeSelector = as;
     }
     
-    Policy resolveReference(PolicyReference ref, Element e, PolicyBuilder builder, Bus bus)
{
+    Policy resolveReference(PolicyReference ref, PolicyBuilder builder, Bus bus, DescriptionInfo
i) {
         Policy p = null;
         if (!ref.getURI().startsWith("#")) {
-            p = resolveExternal(ref, e.getBaseURI(), bus);
+            p = resolveExternal(ref, i.getBaseURI(), bus);
         } else {
-            p = resolveLocal(ref, e, bus);
+            p = resolveLocal(ref, bus, i);
         }
         if (null == p) {
             throw new PolicyException(new Message("UNRESOLVED_POLICY_REFERENCE_EXC", BUNDLE,
ref.getURI()));
@@ -230,9 +231,9 @@ public class WSPolicyFeature extends Abs
         return p;
     }   
     
-    Policy resolveLocal(PolicyReference ref, Element e, final Bus bus) {
+    Policy resolveLocal(PolicyReference ref, final Bus bus, DescriptionInfo i) {
         String uri = ref.getURI().substring(1);
-        String absoluteURI = e.getBaseURI() + uri;
+        String absoluteURI = i.getBaseURI() + uri;
         PolicyRegistry registry = bus.getExtension(PolicyEngine.class).getRegistry();
         Policy resolved = registry.lookup(absoluteURI);
         if (null != resolved) {

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertion.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertion.java?rev=1445307&r1=1445306&r2=1445307&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertion.java
(original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertion.java
Tue Feb 12 18:47:36 2013
@@ -60,6 +60,9 @@ public class PrimitiveAssertion 
     
     @Override
     protected Assertion clone(boolean opt) {
+        if (opt == this.optional) {
+            return this;
+        }
         return new PrimitiveAssertion(name, opt, ignorable);
     }
 

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SP12Constants.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SP12Constants.java?rev=1445307&r1=1445306&r2=1445307&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SP12Constants.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SP12Constants.java
Tue Feb 12 18:47:36 2013
@@ -21,6 +21,7 @@ package org.apache.cxf.ws.security.polic
 import javax.xml.namespace.QName;
 
 import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion;
 
 public final class SP12Constants extends SPConstants {
 
@@ -346,6 +347,9 @@ public final class SP12Constants extends
     public static final QName ATTACHMENTS = new QName(SP12Constants.SP_NS, SPConstants.ATTACHMENTS);
     
     ////////////////////////////////////////////////////////////////////////////////////////////////
+    
+    public static final PrimitiveAssertion INCLUDE_TIMESTAMP_ASSERTION = new PrimitiveAssertion(INCLUDE_TIMESTAMP);
+    
     private SP12Constants() {
         
     }

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/AsymmetricBinding.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/AsymmetricBinding.java?rev=1445307&r1=1445306&r2=1445307&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/AsymmetricBinding.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/AsymmetricBinding.java
Tue Feb 12 18:47:36 2013
@@ -24,7 +24,6 @@ import javax.xml.stream.XMLStreamExcepti
 import javax.xml.stream.XMLStreamWriter;
 
 import org.apache.cxf.ws.policy.PolicyBuilder;
-import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion;
 import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
 import org.apache.neethi.All;
@@ -180,7 +179,7 @@ public class AsymmetricBinding extends S
         }
         */
         if (isIncludeTimestamp()) {
-            all.addPolicyComponent(new PrimitiveAssertion(SP12Constants.INCLUDE_TIMESTAMP));
+            all.addPolicyComponent(SP12Constants.INCLUDE_TIMESTAMP_ASSERTION);
         }
         if (getLayout() != null) {
             all.addPolicyComponent(getLayout());

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SymmetricBinding.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SymmetricBinding.java?rev=1445307&r1=1445306&r2=1445307&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SymmetricBinding.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SymmetricBinding.java
Tue Feb 12 18:47:36 2013
@@ -23,7 +23,6 @@ import javax.xml.stream.XMLStreamExcepti
 import javax.xml.stream.XMLStreamWriter;
 
 import org.apache.cxf.ws.policy.PolicyBuilder;
-import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion;
 import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
 import org.apache.neethi.All;
@@ -128,7 +127,7 @@ public class SymmetricBinding extends Sy
             all.addPolicyComponent(this.getEncryptionToken());
         }
         if (isIncludeTimestamp()) {
-            all.addPolicyComponent(new PrimitiveAssertion(SP12Constants.INCLUDE_TIMESTAMP));
+            all.addPolicyComponent(SP12Constants.INCLUDE_TIMESTAMP_ASSERTION);
         }
         if (getLayout() != null) {
             all.addPolicyComponent(getLayout());

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=1445307&r1=1445306&r2=1445307&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
Tue Feb 12 18:47:36 2013
@@ -23,7 +23,6 @@ import javax.xml.stream.XMLStreamExcepti
 import javax.xml.stream.XMLStreamWriter;
 
 import org.apache.cxf.ws.policy.PolicyBuilder;
-import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion;
 import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
 import org.apache.neethi.All;
@@ -137,7 +136,7 @@ public class TransportBinding extends Bi
             all.addPolicyComponent(transportToken);
         }
         if (isIncludeTimestamp()) {
-            all.addPolicyComponent(new PrimitiveAssertion(SP12Constants.INCLUDE_TIMESTAMP));
+            all.addPolicyComponent(SP12Constants.INCLUDE_TIMESTAMP_ASSERTION);
         }
         if (getLayout() != null) {
             all.addPolicyComponent(getLayout());

Modified: cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/algsuite/AlgorithmSuiteTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/algsuite/AlgorithmSuiteTest.java?rev=1445307&r1=1445306&r2=1445307&view=diff
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/algsuite/AlgorithmSuiteTest.java
(original)
+++ cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/algsuite/AlgorithmSuiteTest.java
Tue Feb 12 18:47:36 2013
@@ -112,7 +112,6 @@ public class AlgorithmSuiteTest extends 
     }
     
     @org.junit.Test
-    @org.junit.Ignore
     public void testCombinedPolicy() throws Exception {
         
         if (!SecurityTestUtil.checkUnrestrictedPoliciesInstalled()) {



Mime
View raw message