You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2013/04/02 21:31:41 UTC

svn commit: r1463712 - in /cxf/branches/wss4j2.0-port/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy: ./ interceptors/

Author: dkulp
Date: Tue Apr  2 19:31:40 2013
New Revision: 1463712

URL: http://svn.apache.org/r1463712
Log:
Start getting some of the SecureConversation tests passing

Modified:
    cxf/branches/wss4j2.0-port/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/WSSecurityPolicyLoader.java
    cxf/branches/wss4j2.0-port/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/SecureConversationInInterceptor.java
    cxf/branches/wss4j2.0-port/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/SecureConversationTokenInterceptorProvider.java

Modified: cxf/branches/wss4j2.0-port/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/WSSecurityPolicyLoader.java
URL: http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/WSSecurityPolicyLoader.java?rev=1463712&r1=1463711&r2=1463712&view=diff
==============================================================================
--- cxf/branches/wss4j2.0-port/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/WSSecurityPolicyLoader.java (original)
+++ cxf/branches/wss4j2.0-port/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/WSSecurityPolicyLoader.java Tue Apr  2 19:31:40 2013
@@ -53,6 +53,7 @@ import org.apache.wss4j.policy.SP11Const
 import org.apache.wss4j.policy.SP12Constants;
 import org.apache.wss4j.policy.SP13Constants;
 import org.apache.wss4j.policy.builders.AsymmetricBindingBuilder;
+import org.apache.wss4j.policy.builders.BootstrapPolicyBuilder;
 import org.apache.wss4j.policy.builders.ContentEncryptedElementsBuilder;
 import org.apache.wss4j.policy.builders.EncryptedElementsBuilder;
 import org.apache.wss4j.policy.builders.EncryptedPartsBuilder;
@@ -130,6 +131,7 @@ public final class WSSecurityPolicyLoade
         reg.registerBuilder(new SamlTokenBuilder());
         reg.registerBuilder(new KerberosTokenBuilder());
         reg.registerBuilder(new SecureConversationTokenBuilder());
+        reg.registerBuilder(new BootstrapPolicyBuilder());
         reg.registerBuilder(new SecurityContextTokenBuilder());
         reg.registerBuilder(new SignedElementsBuilder());
         reg.registerBuilder(new SignedPartsBuilder());
@@ -145,16 +147,6 @@ public final class WSSecurityPolicyLoade
         reg.registerBuilder(new WSS10Builder());
         reg.registerBuilder(new WSS11Builder());
         reg.registerBuilder(new X509TokenBuilder());
-
-        //This is for the assertions that would contain nested policies
-        reg.registerBuilder(new XMLPrimitiveAssertionBuilder() {
-            public QName[] getKnownElements() {
-                return new QName[] {
-                    //SecureConversation
-                    SP12Constants.BOOTSTRAP_POLICY, SP11Constants.BOOTSTRAP_POLICY,                                    
-                };
-            }
-        });
         
         //add generic assertions for these known things to prevent warnings
         List<QName> others = Arrays.asList(new QName[] {

Modified: cxf/branches/wss4j2.0-port/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/SecureConversationInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/SecureConversationInInterceptor.java?rev=1463712&r1=1463711&r2=1463712&view=diff
==============================================================================
--- cxf/branches/wss4j2.0-port/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/SecureConversationInInterceptor.java (original)
+++ cxf/branches/wss4j2.0-port/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/SecureConversationInInterceptor.java Tue Apr  2 19:31:40 2013
@@ -103,7 +103,8 @@ class SecureConversationInInterceptor ex
                 //client side should be checked on the way out
                 for (AssertionInfo ai : ais) {
                     ai.setAsserted(true);
-                }      
+                }
+                NegotiationUtils.assertPolicy(aim, SPConstants.BOOTSTRAP_POLICY);
                 
                 Object s = message.getContextualProperty(SecurityConstants.STS_TOKEN_DO_CANCEL);
                 if (s != null && (Boolean.TRUE.equals(s) || "true".equalsIgnoreCase(s.toString()))) {
@@ -130,7 +131,7 @@ class SecureConversationInInterceptor ex
 
                 SecureConversationToken tok = (SecureConversationToken)ais.iterator()
                     .next().getAssertion();
-                Policy pol = tok.getBootstrapPolicy();
+                Policy pol = tok.getBootstrapPolicy().getPolicy();
                 if (s.endsWith("Cancel") || s.endsWith("/Renew")) {
                     //Cancel and Renew just sign with the token
                     Policy p = new Policy();

Modified: cxf/branches/wss4j2.0-port/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/SecureConversationTokenInterceptorProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/SecureConversationTokenInterceptorProvider.java?rev=1463712&r1=1463711&r2=1463712&view=diff
==============================================================================
--- cxf/branches/wss4j2.0-port/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/SecureConversationTokenInterceptorProvider.java (original)
+++ cxf/branches/wss4j2.0-port/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/SecureConversationTokenInterceptorProvider.java Tue Apr  2 19:31:40 2013
@@ -68,7 +68,7 @@ public class SecureConversationTokenInte
                             boolean endorse) {
         client.setTrust(NegotiationUtils.getTrust10(aim));
         client.setTrust(NegotiationUtils.getTrust13(aim));
-        Policy pol = itok.getBootstrapPolicy();
+        Policy pol = itok.getBootstrapPolicy().getPolicy();
         Policy p = new Policy();
         ExactlyOne ea = new ExactlyOne();
         p.addPolicyComponent(ea);