cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject cxf git commit: Fixing a few tests without unlimited security policies (on certain JDKS)
Date Mon, 16 Mar 2015 23:24:50 GMT
Repository: cxf
Updated Branches:
  refs/heads/master f94861bd6 -> 5b26ab08f


Fixing a few tests without unlimited security policies (on certain JDKS)


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/5b26ab08
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/5b26ab08
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/5b26ab08

Branch: refs/heads/master
Commit: 5b26ab08f19f6c55a45c0f1f7ddccd09b0a2ed23
Parents: f94861b
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Mon Mar 16 23:24:29 2015 +0000
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Mon Mar 16 23:24:29 2015 +0000

----------------------------------------------------------------------
 .../sts/operation/IssueSamlRealmUnitTest.java   |  5 +++-
 .../token/provider/SAMLProviderKeyTypeTest.java |  3 +++
 .../https/ciphersuites/CipherSuitesTest.java    | 28 ++++++++++++++++++++
 3 files changed, 35 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/5b26ab08/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSamlRealmUnitTest.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSamlRealmUnitTest.java
b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSamlRealmUnitTest.java
index dd3cec3..6667227 100644
--- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSamlRealmUnitTest.java
+++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSamlRealmUnitTest.java
@@ -31,7 +31,6 @@ import javax.xml.namespace.QName;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
-
 import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.jaxws.context.WebServiceContextImpl;
 import org.apache.cxf.jaxws.context.WrappedMessageContext;
@@ -42,6 +41,7 @@ import org.apache.cxf.sts.STSConstants;
 import org.apache.cxf.sts.STSPropertiesMBean;
 import org.apache.cxf.sts.StaticSTSProperties;
 import org.apache.cxf.sts.common.PasswordCallbackHandler;
+import org.apache.cxf.sts.common.TestUtils;
 import org.apache.cxf.sts.service.ServiceMBean;
 import org.apache.cxf.sts.service.StaticService;
 import org.apache.cxf.sts.token.provider.SAMLTokenProvider;
@@ -401,6 +401,9 @@ public class IssueSamlRealmUnitTest extends org.junit.Assert {
      */
     @org.junit.Test
     public void testIssueSaml1TokenRealmBCustomCryptoPKCS12() throws Exception {
+        if (!TestUtils.checkUnrestrictedPoliciesInstalled()) {
+            return;
+        }
         TokenIssueOperation issueOperation = new TokenIssueOperation();
         
         // Add Token Provider

http://git-wip-us.apache.org/repos/asf/cxf/blob/5b26ab08/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/provider/SAMLProviderKeyTypeTest.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/provider/SAMLProviderKeyTypeTest.java
b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/provider/SAMLProviderKeyTypeTest.java
index 8b9cdd7..25c2305 100644
--- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/provider/SAMLProviderKeyTypeTest.java
+++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/provider/SAMLProviderKeyTypeTest.java
@@ -433,6 +433,9 @@ public class SAMLProviderKeyTypeTest extends org.junit.Assert {
      */
     @org.junit.Test
     public void testDefaultSaml1BearerAssertionPKCS12() throws Exception {
+        if (!TestUtils.checkUnrestrictedPoliciesInstalled()) {
+            return;
+        }
         TokenProvider samlTokenProvider = new SAMLTokenProvider();
         TokenProviderParameters providerParameters = 
             createProviderParametersPKCS12(

http://git-wip-us.apache.org/repos/asf/cxf/blob/5b26ab08/systests/transports/src/test/java/org/apache/cxf/systest/https/ciphersuites/CipherSuitesTest.java
----------------------------------------------------------------------
diff --git a/systests/transports/src/test/java/org/apache/cxf/systest/https/ciphersuites/CipherSuitesTest.java
b/systests/transports/src/test/java/org/apache/cxf/systest/https/ciphersuites/CipherSuitesTest.java
index a1002e3..3c85e31 100644
--- a/systests/transports/src/test/java/org/apache/cxf/systest/https/ciphersuites/CipherSuitesTest.java
+++ b/systests/transports/src/test/java/org/apache/cxf/systest/https/ciphersuites/CipherSuitesTest.java
@@ -21,6 +21,9 @@ package org.apache.cxf.systest.https.ciphersuites;
 
 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;
@@ -35,6 +38,27 @@ import org.junit.BeforeClass;
  * A set of tests for TLS ciphersuites
  */
 public class CipherSuitesTest extends AbstractBusClientServerTestBase {
+    static final boolean UNRESTRICTED_POLICIES_INSTALLED;
+    static {
+        boolean ok = false;
+        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);
+            ok = true;
+        } catch (Exception e) {
+            //
+        }
+        UNRESTRICTED_POLICIES_INSTALLED = ok;
+    }
+    
     static final String PORT = allocatePort(CipherSuitesServer.class);
     static final String PORT2 = allocatePort(CipherSuitesServer.class, 2);
     static final String PORT3 = allocatePort(CipherSuitesServer.class, 3);
@@ -109,6 +133,10 @@ public class CipherSuitesTest extends AbstractBusClientServerTestBase
{
     // Both client + server include a specific AES CipherSuite (not via a filter)
     @org.junit.Test
     public void testAESIncludedExplicitly() throws Exception {
+        
+        if (!UNRESTRICTED_POLICIES_INSTALLED) {
+            return;
+        }
         SpringBusFactory bf = new SpringBusFactory();
         URL busFile = CipherSuitesTest.class.getResource("ciphersuites-explicit-client.xml");
 


Mime
View raw message