cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1291217 - in /cxf/trunk: rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/custom/ systests/ws-security/src/test/java/org/apache/cxf/systest/ws/gcm/ systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/gcm/ systes...
Date Mon, 20 Feb 2012 11:49:11 GMT
Author: coheigea
Date: Mon Feb 20 11:49:11 2012
New Revision: 1291217

URL: http://svn.apache.org/viewvc?rev=1291217&view=rev
Log:
Re-enabling GCM tests. Added default custom AlgorithmSuites that can be used for GCM algorithms.

Added:
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/custom/GCMAlgorithmSuite.java
      - copied, changed from r1291189, cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/gcm/GCMAlgorithmSuite.java
Removed:
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/gcm/GCMAlgorithmSuite.java
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/gcm/GCMAlgorithmSuiteLoader.java
Modified:
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/custom/DefaultAlgorithmSuiteLoader.java
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/gcm/GCMTest.java
    cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/gcm/DoubleItGCM.wsdl
    cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/gcm/client/client.xml
    cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/gcm/server/server.xml

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/custom/DefaultAlgorithmSuiteLoader.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/custom/DefaultAlgorithmSuiteLoader.java?rev=1291217&r1=1291216&r2=1291217&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/custom/DefaultAlgorithmSuiteLoader.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/custom/DefaultAlgorithmSuiteLoader.java
Mon Feb 20 11:49:11 2012
@@ -28,13 +28,23 @@ import org.apache.cxf.ws.security.policy
  * This class retrieves the default AlgorithmSuites.
  */
 public class DefaultAlgorithmSuiteLoader implements AlgorithmSuiteLoader {
+    
+    private static final String CXF_CUSTOM_POLICY_NS = 
+         "http://cxf.apache.org/custom/security-policy";
 
     public AlgorithmSuite getAlgorithmSuite(Element policyElement, SPConstants consts) {
         if (policyElement != null) {
-            AlgorithmSuite algorithmSuite = new AlgorithmSuite(consts);
-            String algorithmSuiteName = DOMUtils.getFirstElement(policyElement).getLocalName();
-            algorithmSuite.setAlgorithmSuite(algorithmSuiteName);
-            return algorithmSuite;
+            Element algorithm = DOMUtils.getFirstElement(policyElement);
+            if (algorithm != null) {
+                AlgorithmSuite algorithmSuite = null;
+                if (CXF_CUSTOM_POLICY_NS.equals(algorithm.getNamespaceURI())) {
+                    algorithmSuite = new GCMAlgorithmSuite(consts);
+                } else {
+                    algorithmSuite = new AlgorithmSuite(consts);
+                }
+                algorithmSuite.setAlgorithmSuite(algorithm.getLocalName());
+                return algorithmSuite;
+            }
         }
         return null;
     }

Copied: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/custom/GCMAlgorithmSuite.java
(from r1291189, cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/gcm/GCMAlgorithmSuite.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/custom/GCMAlgorithmSuite.java?p2=cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/custom/GCMAlgorithmSuite.java&p1=cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/gcm/GCMAlgorithmSuite.java&r1=1291189&r2=1291217&rev=1291217&view=diff
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/gcm/GCMAlgorithmSuite.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/custom/GCMAlgorithmSuite.java
Mon Feb 20 11:49:11 2012
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.cxf.systest.ws.gcm;
+package org.apache.cxf.ws.security.policy.custom;
 
 import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
@@ -56,6 +56,16 @@ public class GCMAlgorithmSuite extends A
             this.encryptionDerivedKeyLength = 128;
             this.signatureDerivedKeyLength = 128;
             this.minimumSymmetricKeyLength = 128;
+        } else if ("Basic192GCM".equals(algoSuite)) {
+            this.digest = SPConstants.SHA1;
+            this.encryption = "http://www.w3.org/2009/xmlenc11#aes192-gcm";
+            this.symmetricKeyWrap = SPConstants.KW_AES192;
+            this.asymmetricKeyWrap = SPConstants.KW_RSA_OAEP;
+            this.encryptionKeyDerivation = SPConstants.P_SHA1_L192;
+            this.signatureKeyDerivation = SPConstants.P_SHA1_L192;
+            this.encryptionDerivedKeyLength = 192;
+            this.signatureDerivedKeyLength = 192;
+            this.minimumSymmetricKeyLength = 192;
         } else if ("Basic256GCM".equals(algoSuite)) {
             this.digest = SPConstants.SHA1;
             this.encryption = "http://www.w3.org/2009/xmlenc11#aes256-gcm";

Modified: cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/gcm/GCMTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/gcm/GCMTest.java?rev=1291217&r1=1291216&r2=1291217&view=diff
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/gcm/GCMTest.java
(original)
+++ cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/gcm/GCMTest.java
Mon Feb 20 11:49:11 2012
@@ -58,7 +58,6 @@ public class GCMTest extends AbstractBus
     }
 
     @org.junit.Test
-    @org.junit.Ignore
     public void testAESGCM128() throws Exception {
         if (!unrestrictedPoliciesInstalled) {
             return;
@@ -81,7 +80,28 @@ public class GCMTest extends AbstractBus
     }
     
     @org.junit.Test
-    @org.junit.Ignore
+    public void testAESGCM192() throws Exception {
+        if (!unrestrictedPoliciesInstalled) {
+            return;
+        }
+
+        SpringBusFactory bf = new SpringBusFactory();
+        URL busFile = GCMTest.class.getResource("client/client.xml");
+
+        Bus bus = bf.createBus(busFile.toString());
+        SpringBusFactory.setDefaultBus(bus);
+        SpringBusFactory.setThreadDefaultBus(bus);
+        
+        URL wsdl = GCMTest.class.getResource("DoubleItGCM.wsdl");
+        Service service = Service.create(wsdl, SERVICE_QNAME);
+        QName portQName = new QName(NAMESPACE, "DoubleItGCM192Port");
+        DoubleItPortType gcmPort = 
+                service.getPort(portQName, DoubleItPortType.class);
+        updateAddressPort(gcmPort, PORT);
+        gcmPort.doubleIt(25);
+    }
+    
+    @org.junit.Test
     public void testAESGCM256() throws Exception {
         if (!unrestrictedPoliciesInstalled) {
             return;

Modified: cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/gcm/DoubleItGCM.wsdl
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/gcm/DoubleItGCM.wsdl?rev=1291217&r1=1291216&r2=1291217&view=diff
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/gcm/DoubleItGCM.wsdl
(original)
+++ cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/gcm/DoubleItGCM.wsdl
Mon Feb 20 11:49:11 2012
@@ -50,6 +50,26 @@
         </wsdl:operation>
     </wsdl:binding>
     
+    <wsdl:binding name="DoubleItGCM192Binding" type="tns:DoubleItPortType">
+        <wsp:PolicyReference URI="#DoubleItGCM192Policy" />
+        <soap:binding style="document"
+            transport="http://schemas.xmlsoap.org/soap/http" />
+        <wsdl:operation name="DoubleIt">
+            <soap:operation soapAction="" />
+            <wsdl:input>
+                <soap:body use="literal" />
+                <wsp:PolicyReference URI="#DoubleItBinding_DoubleIt_Input_Policy"/>
+            </wsdl:input>
+            <wsdl:output>
+                <soap:body use="literal" />
+                <wsp:PolicyReference URI="#DoubleItBinding_DoubleIt_Output_Policy"/>
+            </wsdl:output>
+            <wsdl:fault name="DoubleItFault">
+                <soap:body use="literal" name="DoubleItFault" />
+            </wsdl:fault>
+        </wsdl:operation>
+    </wsdl:binding>
+    
     <wsdl:binding name="DoubleItGCM256Binding" type="tns:DoubleItPortType">
         <wsp:PolicyReference URI="#DoubleItGCM256Policy" />
         <soap:binding style="document"
@@ -74,6 +94,9 @@
         <wsdl:port name="DoubleItGCM128Port" binding="tns:DoubleItGCM128Binding">
             <soap:address location="http://localhost:9001/DoubleItGCM128" />
         </wsdl:port>
+        <wsdl:port name="DoubleItGCM192Port" binding="tns:DoubleItGCM192Binding">
+            <soap:address location="http://localhost:9001/DoubleItGCM192" />
+        </wsdl:port>
         <wsdl:port name="DoubleItGCM256Port" binding="tns:DoubleItGCM256Binding">
             <soap:address location="http://localhost:9001/DoubleItGCM256" />
         </wsdl:port>
@@ -113,7 +136,50 @@
                   <sp:OnlySignEntireHeadersAndBody/>
                   <sp:AlgorithmSuite>
                      <wsp:Policy>
-                        <sp:Basic128GCM/>
+                        <sp-cxf:Basic128GCM xmlns:sp-cxf="http://cxf.apache.org/custom/security-policy"/>
+                     </wsp:Policy>
+                  </sp:AlgorithmSuite>
+               </wsp:Policy>
+            </sp:AsymmetricBinding>
+         </wsp:All>
+      </wsp:ExactlyOne>
+    </wsp:Policy>
+    
+    <wsp:Policy wsu:Id="DoubleItGCM192Policy">
+      <wsp:ExactlyOne>
+         <wsp:All>
+            <sp:AsymmetricBinding>
+               <wsp:Policy>
+                  <sp:InitiatorToken>
+                     <wsp:Policy>
+                        <sp:X509Token
+                           sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient">
+                           <wsp:Policy>
+                              <sp:WssX509V3Token10 />
+                           </wsp:Policy>
+                        </sp:X509Token>
+                     </wsp:Policy>
+                  </sp:InitiatorToken>
+                  <sp:RecipientToken>
+                     <wsp:Policy>
+                        <sp:X509Token
+                           sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/Never">
+                           <wsp:Policy>
+                              <sp:WssX509V3Token10 />
+                           </wsp:Policy>
+                        </sp:X509Token>
+                     </wsp:Policy>
+                  </sp:RecipientToken>
+                  <sp:Layout>
+                     <wsp:Policy>
+                        <sp:Lax/>
+                     </wsp:Policy>
+                  </sp:Layout>
+                  <sp:IncludeTimestamp/>
+                  <sp:OnlySignEntireHeadersAndBody/>
+                  <sp:AlgorithmSuite>
+                     <wsp:Policy>
+                        <sp-cxf:Basic192GCM xmlns:sp-cxf="http://cxf.apache.org/custom/security-policy"/>
                      </wsp:Policy>
                   </sp:AlgorithmSuite>
                </wsp:Policy>
@@ -156,7 +222,7 @@
                   <sp:OnlySignEntireHeadersAndBody/>
                   <sp:AlgorithmSuite>
                      <wsp:Policy>
-                        <sp:Basic256GCM/>
+                        <sp-cxf:Basic256GCM xmlns:sp-cxf="http://cxf.apache.org/custom/security-policy"/>
                      </wsp:Policy>
                   </sp:AlgorithmSuite>
                </wsp:Policy>

Modified: cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/gcm/client/client.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/gcm/client/client.xml?rev=1291217&r1=1291216&r2=1291217&view=diff
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/gcm/client/client.xml
(original)
+++ cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/gcm/client/client.xml
Mon Feb 20 11:49:11 2012
@@ -39,11 +39,6 @@
         </cxf:features>
     </cxf:bus>
     
-    <bean id="restrictedPolicyLoader"
-          class="org.apache.cxf.systest.ws.gcm.GCMAlgorithmSuiteLoader" >
-          <constructor-arg ref="cxf"/>
-    </bean>
-    
     <jaxws:client name="{http://www.example.org/contract/DoubleIt}DoubleItGCM128Port"

                   createdFromAPI="true">
        <jaxws:properties>
@@ -58,6 +53,20 @@
        </jaxws:properties>
     </jaxws:client>
     
+    <jaxws:client name="{http://www.example.org/contract/DoubleIt}DoubleItGCM192Port"

+                  createdFromAPI="true">
+       <jaxws:properties>
+           <entry key="ws-security.encryption.properties" 
+                  value="org/apache/cxf/systest/ws/wssec10/client/bob.properties"/> 
+           <entry key="ws-security.encryption.username" value="bob"/>
+           <entry key="ws-security.signature.properties" 
+                  value="org/apache/cxf/systest/ws/wssec10/client/alice.properties"/>

+           <entry key="ws-security.signature.username" value="alice"/>
+           <entry key="ws-security.callback-handler" 
+                  value="org.apache.cxf.systest.ws.wssec10.client.KeystorePasswordCallback"/>
+       </jaxws:properties>
+    </jaxws:client>
+    
     <jaxws:client name="{http://www.example.org/contract/DoubleIt}DoubleItGCM256Port"

                   createdFromAPI="true">
        <jaxws:properties>

Modified: cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/gcm/server/server.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/gcm/server/server.xml?rev=1291217&r1=1291216&r2=1291217&view=diff
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/gcm/server/server.xml
(original)
+++ cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/gcm/server/server.xml
Mon Feb 20 11:49:11 2012
@@ -43,11 +43,6 @@
         </cxf:features>
     </cxf:bus>
     
-    <bean id="restrictedPolicyLoader"
-          class="org.apache.cxf.systest.ws.gcm.GCMAlgorithmSuiteLoader" >
-          <constructor-arg ref="cxf"/>
-    </bean>
-    
     <jaxws:endpoint 
        id="GCM128"
        address="http://localhost:${testutil.ports.Server}/DoubleItGCM128" 
@@ -70,6 +65,27 @@
     </jaxws:endpoint> 
     
     <jaxws:endpoint 
+       id="GCM192"
+       address="http://localhost:${testutil.ports.Server}/DoubleItGCM192" 
+       serviceName="s:DoubleItService"
+       endpointName="s:DoubleItGCM192Port"
+       xmlns:s="http://www.example.org/contract/DoubleIt"
+       implementor="org.apache.cxf.systest.ws.common.DoubleItImpl"
+       wsdlLocation="org/apache/cxf/systest/ws/gcm/DoubleItGCM.wsdl">
+        
+       <jaxws:properties>
+          <entry key="ws-security.callback-handler" 
+                  value="org.apache.cxf.systest.ws.wssec10.client.KeystorePasswordCallback"/>
+          <entry key="ws-security.signature.properties" 
+                  value="org/apache/cxf/systest/ws/wssec10/client/bob.properties"/> 
+          <entry key="ws-security.encryption.properties" 
+                  value="org/apache/cxf/systest/ws/wssec10/client/alice.properties"/>

+          <entry key="ws-security.encryption.username" value="alice"/>
+       </jaxws:properties> 
+     
+    </jaxws:endpoint> 
+    
+    <jaxws:endpoint 
        id="GCM256"
        address="http://localhost:${testutil.ports.Server}/DoubleItGCM256" 
        serviceName="s:DoubleItService"



Mime
View raw message