cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1089055 - in /cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml: SamlTokenTest.java client/SamlCallbackHandler.java
Date Tue, 05 Apr 2011 14:08:43 GMT
Author: coheigea
Date: Tue Apr  5 14:08:42 2011
New Revision: 1089055

URL: http://svn.apache.org/viewvc?rev=1089055&view=rev
Log:
Disabled some of the SAML systests for the unlimited security case.

Modified:
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/SamlTokenTest.java
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/client/SamlCallbackHandler.java

Modified: cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/SamlTokenTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/SamlTokenTest.java?rev=1089055&r1=1089054&r2=1089055&view=diff
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/SamlTokenTest.java
(original)
+++ cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/SamlTokenTest.java
Tue Apr  5 14:08:42 2011
@@ -22,6 +22,9 @@ package org.apache.cxf.systest.ws.saml;
 import java.math.BigInteger;
 import java.net.URL;
 
+import javax.crypto.Cipher;
+import javax.crypto.SecretKey;
+import javax.crypto.spec.SecretKeySpec;
 import javax.xml.ws.BindingProvider;
 
 import org.apache.cxf.Bus;
@@ -39,6 +42,8 @@ import wssec.saml.DoubleItService;
  */
 public class SamlTokenTest extends AbstractBusClientServerTestBase {
     
+    private boolean unrestrictedPoliciesInstalled = checkUnrestrictedPoliciesInstalled();
+    
     @BeforeClass
     public static void startServers() throws Exception {
         assertTrue(
@@ -92,6 +97,9 @@ public class SamlTokenTest extends Abstr
     @org.junit.Test
     public void testSaml2OverSymmetric() throws Exception {
 
+        if (!unrestrictedPoliciesInstalled) {
+            return;
+        }
         SpringBusFactory bf = new SpringBusFactory();
         URL busFile = SamlTokenTest.class.getResource("client/client.xml");
 
@@ -132,6 +140,10 @@ public class SamlTokenTest extends Abstr
     @org.junit.Test
     public void testSaml2OverAsymmetric() throws Exception {
 
+        if (!unrestrictedPoliciesInstalled) {
+            return;
+        }
+        
         SpringBusFactory bf = new SpringBusFactory();
         URL busFile = SamlTokenTest.class.getResource("client/client.xml");
 
@@ -192,4 +204,23 @@ public class SamlTokenTest extends Abstr
         assert result.equals(BigInteger.valueOf(50));
     }
     
+    
+    private boolean checkUnrestrictedPoliciesInstalled() {
+        try {
+            byte[] data = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07};
+
+            SecretKey key192 = new SecretKeySpec(
+                new byte[] {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+                            0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+                            0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17},
+                            "AES");
+            Cipher c = Cipher.getInstance("AES");
+            c.init(Cipher.ENCRYPT_MODE, key192);
+            c.doFinal(data);
+            return true;
+        } catch (Exception e) {
+            //
+        }
+        return false;
+    }
 }

Modified: cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/client/SamlCallbackHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/client/SamlCallbackHandler.java?rev=1089055&r1=1089054&r2=1089055&view=diff
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/client/SamlCallbackHandler.java
(original)
+++ cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/client/SamlCallbackHandler.java
Tue Apr  5 14:08:42 2011
@@ -30,6 +30,7 @@ import org.apache.ws.security.saml.ext.S
 import org.apache.ws.security.saml.ext.bean.AttributeBean;
 import org.apache.ws.security.saml.ext.bean.AttributeStatementBean;
 import org.apache.ws.security.saml.ext.bean.SubjectBean;
+import org.apache.ws.security.saml.ext.builder.SAML1Constants;
 import org.apache.ws.security.saml.ext.builder.SAML2Constants;
 import org.opensaml.common.SAMLVersion;
 
@@ -59,7 +60,10 @@ public class SamlCallbackHandler impleme
                 callback.setIssuer("sts");
                 String subjectName = "uid=sts-client,o=mock-sts.com";
                 String subjectQualifier = "www.mock-sts.com";
-                String confirmationMethod = SAML2Constants.CONF_BEARER;
+                String confirmationMethod = SAML2Constants.CONF_SENDER_VOUCHES;
+                if (!saml2) {
+                    confirmationMethod = SAML1Constants.CONF_SENDER_VOUCHES;
+                }
                 SubjectBean subjectBean = 
                     new SubjectBean(
                         subjectName, subjectQualifier, confirmationMethod



Mime
View raw message