http://git-wip-us.apache.org/repos/asf/cxf/blob/39d8444b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jwt/JweJwsAlgorithmTest.java ---------------------------------------------------------------------- diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jwt/JweJwsAlgorithmTest.java b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jwt/JweJwsAlgorithmTest.java deleted file mode 100644 index 2742477..0000000 --- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jwt/JweJwsAlgorithmTest.java +++ /dev/null @@ -1,534 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.cxf.systest.jaxrs.security.jwt; - -import java.net.URL; -import java.security.Security; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.ws.rs.core.Response; - -import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; - -import org.apache.cxf.jaxrs.client.WebClient; -import org.apache.cxf.rs.security.jose.jaxrs.JweWriterInterceptor; -import org.apache.cxf.rs.security.jose.jaxrs.JwsWriterInterceptor; -import org.apache.cxf.systest.jaxrs.security.Book; -import org.apache.cxf.systest.jaxrs.security.SecurityTestUtil; -import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase; -import org.bouncycastle.jce.provider.BouncyCastleProvider; -import org.junit.AfterClass; -import org.junit.BeforeClass; - -/** - * Some encryption or signature tests, focus on algorithms. - */ -public class JweJwsAlgorithmTest extends AbstractBusClientServerTestBase { - public static final String PORT = BookServerAlgorithms.PORT; - private static final Boolean SKIP_AES_GCM_TESTS = isJava6(); - - private static boolean isJava6() { - String version = System.getProperty("java.version"); - return 1.6D == Double.parseDouble(version.substring(0, 3)); - } - - @BeforeClass - public static void startServers() throws Exception { - assertTrue("server did not launch correctly", - launchServer(BookServerAlgorithms.class, true)); - registerBouncyCastleIfNeeded(); - } - - private static void registerBouncyCastleIfNeeded() throws Exception { - // Still need it for Oracle Java 7 and Java 8 - Security.addProvider(new BouncyCastleProvider()); - } - - @AfterClass - public static void unregisterBouncyCastleIfNeeded() throws Exception { - Security.removeProvider(BouncyCastleProvider.PROVIDER_NAME); - } - - // - // Encryption tests - // - @org.junit.Test - public void testEncryptionProperties() throws Exception { - - if (SKIP_AES_GCM_TESTS) { - return; - } - - URL busFile = JweJwsAlgorithmTest.class.getResource("client.xml"); - - List<Object> providers = new ArrayList<Object>(); - providers.add(new JacksonJsonProvider()); - providers.add(new JweWriterInterceptor()); - - String address = "http://localhost:" + PORT + "/jweoaepgcm/bookstore/books"; - WebClient client = - WebClient.create(address, providers, busFile.toString()); - client.type("application/json").accept("application/json"); - - Map<String, Object> properties = new HashMap<String, Object>(); - properties.put("rs.security.encryption.properties", - "org/apache/cxf/systest/jaxrs/security/bob.jwk.properties"); - WebClient.getConfig(client).getRequestContext().putAll(properties); - - Response response = client.post(new Book("book", 123L)); - assertEquals(response.getStatus(), 200); - - Book returnedBook = response.readEntity(Book.class); - assertEquals(returnedBook.getName(), "book"); - assertEquals(returnedBook.getId(), 123L); - } - - @org.junit.Test - public void testEncryptionDynamic() throws Exception { - - if (SKIP_AES_GCM_TESTS) { - return; - } - - URL busFile = JweJwsAlgorithmTest.class.getResource("client.xml"); - - List<Object> providers = new ArrayList<Object>(); - providers.add(new JacksonJsonProvider()); - providers.add(new JweWriterInterceptor()); - - String address = "http://localhost:" + PORT + "/jweoaepgcm/bookstore/books"; - WebClient client = - WebClient.create(address, providers, busFile.toString()); - client.type("application/json").accept("application/json"); - - Map<String, Object> properties = new HashMap<String, Object>(); - properties.put("rs.security.keystore.type", "jwk"); - properties.put("rs.security.keystore.alias", "2011-04-29"); - properties.put("rs.security.keystore.file", "org/apache/cxf/systest/jaxrs/security/certs/jwkPublicSet.txt"); - properties.put("rs.security.encryption.content.algorithm", "A128GCM"); - properties.put("rs.security.encryption.key.algorithm", "RSA-OAEP"); - WebClient.getConfig(client).getRequestContext().putAll(properties); - - Response response = client.post(new Book("book", 123L)); - assertEquals(response.getStatus(), 200); - - Book returnedBook = response.readEntity(Book.class); - assertEquals(returnedBook.getName(), "book"); - assertEquals(returnedBook.getId(), 123L); - } - - @org.junit.Test - public void testWrongKeyEncryptionAlgorithm() throws Exception { - - if (SKIP_AES_GCM_TESTS) { - return; - } - - URL busFile = JweJwsAlgorithmTest.class.getResource("client.xml"); - - List<Object> providers = new ArrayList<Object>(); - providers.add(new JacksonJsonProvider()); - providers.add(new JweWriterInterceptor()); - - String address = "http://localhost:" + PORT + "/jweoaepgcm/bookstore/books"; - WebClient client = - WebClient.create(address, providers, busFile.toString()); - client.type("application/json").accept("application/json"); - - Map<String, Object> properties = new HashMap<String, Object>(); - properties.put("rs.security.keystore.type", "jwk"); - properties.put("rs.security.keystore.alias", "2011-04-29"); - properties.put("rs.security.keystore.file", "org/apache/cxf/systest/jaxrs/security/certs/jwkPublicSet.txt"); - properties.put("rs.security.encryption.content.algorithm", "A128GCM"); - properties.put("rs.security.encryption.key.algorithm", "RSA1_5"); - WebClient.getConfig(client).getRequestContext().putAll(properties); - - Response response = client.post(new Book("book", 123L)); - assertNotEquals(response.getStatus(), 200); - } - - @org.junit.Test - public void testWrongKeyEncryptionAlgorithmKeyIncluded() throws Exception { - if (SKIP_AES_GCM_TESTS) { - return; - } - URL busFile = JweJwsAlgorithmTest.class.getResource("client.xml"); - - List<Object> providers = new ArrayList<Object>(); - providers.add(new JacksonJsonProvider()); - providers.add(new JweWriterInterceptor()); - - String address = "http://localhost:" + PORT + "/jweoaepgcm/bookstore/books"; - WebClient client = - WebClient.create(address, providers, busFile.toString()); - client.type("application/json").accept("application/json"); - - Map<String, Object> properties = new HashMap<String, Object>(); - properties.put("rs.security.keystore.type", "jwk"); - properties.put("rs.security.keystore.alias", "2011-04-29"); - properties.put("rs.security.keystore.file", "org/apache/cxf/systest/jaxrs/security/certs/jwkPublicSet.txt"); - properties.put("rs.security.encryption.content.algorithm", "A128GCM"); - properties.put("rs.security.encryption.key.algorithm", "RSA1_5"); - properties.put("rs.security.encryption.include.public.key", "true"); - WebClient.getConfig(client).getRequestContext().putAll(properties); - - Response response = client.post(new Book("book", 123L)); - assertNotEquals(response.getStatus(), 200); - } - - @org.junit.Test - public void testWrongContentEncryptionAlgorithm() throws Exception { - - if (SKIP_AES_GCM_TESTS || !SecurityTestUtil.checkUnrestrictedPoliciesInstalled()) { - return; - } - - URL busFile = JweJwsAlgorithmTest.class.getResource("client.xml"); - - List<Object> providers = new ArrayList<Object>(); - providers.add(new JacksonJsonProvider()); - providers.add(new JweWriterInterceptor()); - - String address = "http://localhost:" + PORT + "/jweoaepgcm/bookstore/books"; - WebClient client = - WebClient.create(address, providers, busFile.toString()); - client.type("application/json").accept("application/json"); - - Map<String, Object> properties = new HashMap<String, Object>(); - properties.put("rs.security.keystore.type", "jwk"); - properties.put("rs.security.keystore.alias", "2011-04-29"); - properties.put("rs.security.keystore.file", "org/apache/cxf/systest/jaxrs/security/certs/jwkPublicSet.txt"); - properties.put("rs.security.encryption.content.algorithm", "A192GCM"); - properties.put("rs.security.encryption.key.algorithm", "RSA-OAEP"); - WebClient.getConfig(client).getRequestContext().putAll(properties); - - Response response = client.post(new Book("book", 123L)); - assertNotEquals(response.getStatus(), 200); - } - - @org.junit.Test - public void testBadEncryptingKey() throws Exception { - - if (SKIP_AES_GCM_TESTS) { - return; - } - - URL busFile = JweJwsAlgorithmTest.class.getResource("client.xml"); - - List<Object> providers = new ArrayList<Object>(); - providers.add(new JacksonJsonProvider()); - providers.add(new JweWriterInterceptor()); - - String address = "http://localhost:" + PORT + "/jweoaepgcm/bookstore/books"; - WebClient client = - WebClient.create(address, providers, busFile.toString()); - client.type("application/json").accept("application/json"); - - Map<String, Object> properties = new HashMap<String, Object>(); - properties.put("rs.security.keystore.type", "jwk"); - properties.put("rs.security.keystore.alias", "AliceCert"); - properties.put("rs.security.keystore.file", "org/apache/cxf/systest/jaxrs/security/certs/jwkPublicSet.txt"); - properties.put("rs.security.encryption.content.algorithm", "A128GCM"); - properties.put("rs.security.encryption.key.algorithm", "RSA-OAEP"); - WebClient.getConfig(client).getRequestContext().putAll(properties); - - Response response = client.post(new Book("book", 123L)); - assertNotEquals(response.getStatus(), 200); - } - - // 1024 bits not allowed with RSA according to the spec - @org.junit.Test - public void testSmallEncryptionKeySize() throws Exception { - - if (SKIP_AES_GCM_TESTS) { - return; - } - - URL busFile = JweJwsAlgorithmTest.class.getResource("client.xml"); - - List<Object> providers = new ArrayList<Object>(); - providers.add(new JacksonJsonProvider()); - providers.add(new JweWriterInterceptor()); - - String address = "http://localhost:" + PORT + "/jwesmallkey/bookstore/books"; - WebClient client = - WebClient.create(address, providers, busFile.toString()); - client.type("application/json").accept("application/json"); - - Map<String, Object> properties = new HashMap<String, Object>(); - properties.put("rs.security.keystore.type", "jks"); - properties.put("rs.security.keystore.alias", "smallkey"); - properties.put("rs.security.keystore.password", "security"); - properties.put("rs.security.keystore.file", - "org/apache/cxf/systest/jaxrs/security/certs/smallkeysize.jks"); - properties.put("rs.security.encryption.content.algorithm", "A128GCM"); - properties.put("rs.security.encryption.key.algorithm", "RSA-OAEP"); - WebClient.getConfig(client).getRequestContext().putAll(properties); - - Response response = client.post(new Book("book", 123L)); - assertNotEquals(response.getStatus(), 200); - } - - // - // Signature tests - // - - @org.junit.Test - public void testSignatureProperties() throws Exception { - - URL busFile = JweJwsAlgorithmTest.class.getResource("client.xml"); - - List<Object> providers = new ArrayList<Object>(); - providers.add(new JacksonJsonProvider()); - providers.add(new JwsWriterInterceptor()); - - String address = "http://localhost:" + PORT + "/jws/bookstore/books"; - WebClient client = - WebClient.create(address, providers, busFile.toString()); - client.type("application/json").accept("application/json"); - - Map<String, Object> properties = new HashMap<String, Object>(); - properties.put("rs.security.signature.properties", - "org/apache/cxf/systest/jaxrs/security/alice.jwk.properties"); - WebClient.getConfig(client).getRequestContext().putAll(properties); - - Response response = client.post(new Book("book", 123L)); - assertEquals(response.getStatus(), 200); - - Book returnedBook = response.readEntity(Book.class); - assertEquals(returnedBook.getName(), "book"); - assertEquals(returnedBook.getId(), 123L); - } - - @org.junit.Test - public void testSignatureDynamic() throws Exception { - - URL busFile = JweJwsAlgorithmTest.class.getResource("client.xml"); - - List<Object> providers = new ArrayList<Object>(); - providers.add(new JacksonJsonProvider()); - providers.add(new JwsWriterInterceptor()); - - String address = "http://localhost:" + PORT + "/jws/bookstore/books"; - WebClient client = - WebClient.create(address, providers, busFile.toString()); - client.type("application/json").accept("application/json"); - - Map<String, Object> properties = new HashMap<String, Object>(); - properties.put("rs.security.keystore.type", "jwk"); - properties.put("rs.security.keystore.alias", "2011-04-29"); - properties.put("rs.security.keystore.file", - "org/apache/cxf/systest/jaxrs/security/certs/jwkPrivateSet.txt"); - properties.put("rs.security.signature.algorithm", "RS256"); - WebClient.getConfig(client).getRequestContext().putAll(properties); - - Response response = client.post(new Book("book", 123L)); - assertEquals(response.getStatus(), 200); - - Book returnedBook = response.readEntity(Book.class); - assertEquals(returnedBook.getName(), "book"); - assertEquals(returnedBook.getId(), 123L); - } - - @org.junit.Test - public void testWrongSignatureAlgorithm() throws Exception { - - URL busFile = JweJwsAlgorithmTest.class.getResource("client.xml"); - - List<Object> providers = new ArrayList<Object>(); - providers.add(new JacksonJsonProvider()); - providers.add(new JwsWriterInterceptor()); - - String address = "http://localhost:" + PORT + "/jws/bookstore/books"; - WebClient client = - WebClient.create(address, providers, busFile.toString()); - client.type("application/json").accept("application/json"); - - Map<String, Object> properties = new HashMap<String, Object>(); - properties.put("rs.security.keystore.type", "jwk"); - properties.put("rs.security.keystore.alias", "2011-04-29"); - properties.put("rs.security.keystore.file", - "org/apache/cxf/systest/jaxrs/security/certs/jwkPrivateSet.txt"); - properties.put("rs.security.signature.algorithm", "PS256"); - WebClient.getConfig(client).getRequestContext().putAll(properties); - - Response response = client.post(new Book("book", 123L)); - assertNotEquals(response.getStatus(), 200); - } - - @org.junit.Test - public void testWrongSignatureAlgorithmKeyIncluded() throws Exception { - - URL busFile = JweJwsAlgorithmTest.class.getResource("client.xml"); - - List<Object> providers = new ArrayList<Object>(); - providers.add(new JacksonJsonProvider()); - providers.add(new JwsWriterInterceptor()); - - String address = "http://localhost:" + PORT + "/jws/bookstore/books"; - WebClient client = - WebClient.create(address, providers, busFile.toString()); - client.type("application/json").accept("application/json"); - - Map<String, Object> properties = new HashMap<String, Object>(); - properties.put("rs.security.keystore.type", "jwk"); - properties.put("rs.security.keystore.alias", "2011-04-29"); - properties.put("rs.security.keystore.file", - "org/apache/cxf/systest/jaxrs/security/certs/jwkPrivateSet.txt"); - properties.put("rs.security.signature.algorithm", "PS256"); - properties.put("rs.security.signature.include.public.key", true); - WebClient.getConfig(client).getRequestContext().putAll(properties); - - Response response = client.post(new Book("book", 123L)); - assertNotEquals(response.getStatus(), 200); - } - - @org.junit.Test - public void testBadSigningKey() throws Exception { - - URL busFile = JweJwsAlgorithmTest.class.getResource("client.xml"); - - List<Object> providers = new ArrayList<Object>(); - providers.add(new JacksonJsonProvider()); - providers.add(new JwsWriterInterceptor()); - - String address = "http://localhost:" + PORT + "/jws/bookstore/books"; - WebClient client = - WebClient.create(address, providers, busFile.toString()); - client.type("application/json").accept("application/json"); - - Map<String, Object> properties = new HashMap<String, Object>(); - properties.put("rs.security.keystore.type", "jks"); - properties.put("rs.security.keystore.password", "password"); - properties.put("rs.security.key.password", "password"); - properties.put("rs.security.keystore.alias", "alice"); - properties.put("rs.security.keystore.file", - "org/apache/cxf/systest/jaxrs/security/certs/alice.jks"); - properties.put("rs.security.signature.algorithm", "RS256"); - WebClient.getConfig(client).getRequestContext().putAll(properties); - - Response response = client.post(new Book("book", 123L)); - assertNotEquals(response.getStatus(), 200); - } - - @org.junit.Test - public void testSignatureEllipticCurve() throws Exception { - - URL busFile = JweJwsAlgorithmTest.class.getResource("client.xml"); - - List<Object> providers = new ArrayList<Object>(); - providers.add(new JacksonJsonProvider()); - providers.add(new JwsWriterInterceptor()); - - String address = "http://localhost:" + PORT + "/jwsec/bookstore/books"; - WebClient client = - WebClient.create(address, providers, busFile.toString()); - client.type("application/json").accept("application/json"); - - Map<String, Object> properties = new HashMap<String, Object>(); - properties.put("rs.security.keystore.type", "jwk"); - properties.put("rs.security.keystore.alias", "ECKey"); - properties.put("rs.security.keystore.file", - "org/apache/cxf/systest/jaxrs/security/certs/jwkPrivateSet.txt"); - properties.put("rs.security.signature.algorithm", "ES256"); - WebClient.getConfig(client).getRequestContext().putAll(properties); - - Response response = client.post(new Book("book", 123L)); - assertEquals(response.getStatus(), 200); - - Book returnedBook = response.readEntity(Book.class); - assertEquals(returnedBook.getName(), "book"); - assertEquals(returnedBook.getId(), 123L); - } - - @org.junit.Test - public void testManualSignature() throws Exception { - - URL busFile = JweJwsAlgorithmTest.class.getResource("client.xml"); - - List<Object> providers = new ArrayList<Object>(); - providers.add(new JacksonJsonProvider()); - - String address = "http://localhost:" + PORT + "/jws/bookstore/books"; - WebClient client = - WebClient.create(address, providers, busFile.toString()); - client.type("application/json").accept("application/json"); - - Map<String, Object> properties = new HashMap<String, Object>(); - WebClient.getConfig(client).getRequestContext().putAll(properties); - - String header = "eyJhbGciOiJSUzI1NiIsImN0eSI6Impzb24ifQ"; - String payload = "eyJCb29rIjp7ImlkIjoxMjMsIm5hbWUiOiJib29rIn19"; - String sig = "mZJVPy83atFNxQMeJqkVbR8t1srr9LgKBGT0hgiymjNepRgqedvFG5B8E8UPAzfzNLsos91gGdneUEKrWauU4GoDPTzngX" - + "798aDP6lsn5bUoTMKLfaWp9uzHDIzLMjGkabn92nrIpdK4JKDYNjdSUJIT2L97jggg0aoLhJQHVw2LdF1fpYdM-HCyccNW" - + "HQbAR7bDZdITZFnDi8b22QfHCqeLV7m4mBvNDtNX337wtoUKyjPYBMoWc12hHDCwQyu_gfW6zFioF5TGx-Ifg8hrFlnyUr" - + "vnSdP-FUtXiGeWBIvE_L6gD7DfM4u9hkK757vTjjMR_pF2CW3pfSH-Ha8v0A"; - - // Successful test - Response response = client.post(header + "." + payload + "." + sig); - assertEquals(response.getStatus(), 200); - - Book returnedBook = response.readEntity(Book.class); - assertEquals(returnedBook.getName(), "book"); - assertEquals(returnedBook.getId(), 123L); - - // No signature - response = client.post(header + "." + payload + "."); - assertNotEquals(response.getStatus(), 200); - - // Modified signature - String sig2 = sig.replace('y', 'z'); - response = client.post(header + "." + payload + "." + sig2); - assertNotEquals(response.getStatus(), 200); - } - - // 1024 bits not allowed with RSA according to the spec - @org.junit.Test - public void testSmallSignatureKeySize() throws Exception { - - URL busFile = JweJwsAlgorithmTest.class.getResource("client.xml"); - - List<Object> providers = new ArrayList<Object>(); - providers.add(new JacksonJsonProvider()); - providers.add(new JwsWriterInterceptor()); - - String address = "http://localhost:" + PORT + "/jwssmallkey/bookstore/books"; - WebClient client = - WebClient.create(address, providers, busFile.toString()); - client.type("application/json").accept("application/json"); - - Map<String, Object> properties = new HashMap<String, Object>(); - properties.put("rs.security.keystore.type", "jks"); - properties.put("rs.security.keystore.alias", "smallkey"); - properties.put("rs.security.keystore.password", "security"); - properties.put("rs.security.key.password", "security"); - properties.put("rs.security.keystore.file", - "org/apache/cxf/systest/jaxrs/security/certs/smallkeysize.jks"); - properties.put("rs.security.signature.algorithm", "RS256"); - WebClient.getConfig(client).getRequestContext().putAll(properties); - - Response response = client.post(new Book("book", 123L)); - assertNotEquals(response.getStatus(), 200); - } - -}
http://git-wip-us.apache.org/repos/asf/cxf/blob/39d8444b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jwt/JweJwsReferenceTest.java ---------------------------------------------------------------------- diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jwt/JweJwsReferenceTest.java b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jwt/JweJwsReferenceTest.java deleted file mode 100644 index e7f6857..0000000 --- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jwt/JweJwsReferenceTest.java +++ /dev/null @@ -1,385 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.cxf.systest.jaxrs.security.jwt; - -import java.net.URL; -import java.security.Security; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.ws.rs.core.Response; - -import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; - -import org.apache.cxf.jaxrs.client.WebClient; -import org.apache.cxf.rs.security.jose.jaxrs.JweWriterInterceptor; -import org.apache.cxf.rs.security.jose.jaxrs.JwsWriterInterceptor; -import org.apache.cxf.systest.jaxrs.security.Book; -import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase; -import org.bouncycastle.jce.provider.BouncyCastleProvider; - -import org.junit.AfterClass; -import org.junit.BeforeClass; - -/** - * Some encryption or signature tests, focus on how keys and certs are referenced and included. - */ -public class JweJwsReferenceTest extends AbstractBusClientServerTestBase { - public static final String PORT = BookServerReference.PORT; - private static final Boolean SKIP_AES_GCM_TESTS = isJava6(); - @BeforeClass - public static void startServers() throws Exception { - assertTrue("server did not launch correctly", - launchServer(BookServerReference.class, true)); - registerBouncyCastleIfNeeded(); - } - - private static void registerBouncyCastleIfNeeded() throws Exception { - // Still need it for Oracle Java 7 and Java 8 - Security.addProvider(new BouncyCastleProvider()); - } - private static boolean isJava6() { - String version = System.getProperty("java.version"); - return 1.6D == Double.parseDouble(version.substring(0, 3)); - } - @AfterClass - public static void unregisterBouncyCastleIfNeeded() throws Exception { - Security.removeProvider(BouncyCastleProvider.PROVIDER_NAME); - } - - // - // Encryption tests - // - // TODO - @org.junit.Test - @org.junit.Ignore - public void testEncryptionIncludePublicKey() throws Exception { - if (SKIP_AES_GCM_TESTS) { - return; - } - URL busFile = JweJwsReferenceTest.class.getResource("client.xml"); - - List<Object> providers = new ArrayList<Object>(); - providers.add(new JacksonJsonProvider()); - providers.add(new JweWriterInterceptor()); - - String address = "http://localhost:" + PORT + "/jweincludekey/bookstore/books"; - WebClient client = - WebClient.create(address, providers, busFile.toString()); - client.type("application/json").accept("application/json"); - - Map<String, Object> properties = new HashMap<String, Object>(); - properties.put("rs.security.keystore.type", "jwk"); - properties.put("rs.security.keystore.alias", "2011-04-29"); - properties.put("rs.security.keystore.file", "org/apache/cxf/systest/jaxrs/security/certs/jwkPublicSet.txt"); - properties.put("rs.security.encryption.content.algorithm", "A128GCM"); - properties.put("rs.security.encryption.key.algorithm", "RSA-OAEP"); - properties.put("rs.security.encryption.include.public.key", "true"); - WebClient.getConfig(client).getRequestContext().putAll(properties); - - Response response = client.post(new Book("book", 123L)); - assertEquals(response.getStatus(), 200); - } - - @org.junit.Test - public void testEncryptionIncludeCert() throws Exception { - if (SKIP_AES_GCM_TESTS) { - return; - } - URL busFile = JweJwsReferenceTest.class.getResource("client.xml"); - - List<Object> providers = new ArrayList<Object>(); - providers.add(new JacksonJsonProvider()); - providers.add(new JweWriterInterceptor()); - - String address = "http://localhost:" + PORT + "/jweincludecert/bookstore/books"; - WebClient client = - WebClient.create(address, providers, busFile.toString()); - client.type("application/json").accept("application/json"); - - Map<String, Object> properties = new HashMap<String, Object>(); - properties.put("rs.security.keystore.type", "jks"); - properties.put("rs.security.keystore.alias", "bob"); - properties.put("rs.security.keystore.password", "password"); - properties.put("rs.security.key.password", "password"); - properties.put("rs.security.keystore.file", - "org/apache/cxf/systest/jaxrs/security/certs/bob.jks"); - properties.put("rs.security.encryption.content.algorithm", "A128GCM"); - properties.put("rs.security.encryption.key.algorithm", "RSA-OAEP"); - WebClient.getConfig(client).getRequestContext().putAll(properties); - - // First test that it fails without adding a cert (reference). This is because - // the service side does not have an alias configured - - Response response = client.post(new Book("book", 123L)); - assertNotEquals(response.getStatus(), 200); - - // Now it should work - properties.put("rs.security.encryption.include.cert", "true"); - WebClient.getConfig(client).getRequestContext().putAll(properties); - response = client.post(new Book("book", 123L)); - assertEquals(response.getStatus(), 200); - } - - @org.junit.Test - public void testEncryptionIncludeCertNegativeTest() throws Exception { - if (SKIP_AES_GCM_TESTS) { - return; - } - URL busFile = JweJwsReferenceTest.class.getResource("client.xml"); - - List<Object> providers = new ArrayList<Object>(); - providers.add(new JacksonJsonProvider()); - providers.add(new JweWriterInterceptor()); - - String address = "http://localhost:" + PORT + "/jweincludecert/bookstore/books"; - WebClient client = - WebClient.create(address, providers, busFile.toString()); - client.type("application/json").accept("application/json"); - - Map<String, Object> properties = new HashMap<String, Object>(); - properties.put("rs.security.keystore.type", "jks"); - properties.put("rs.security.keystore.alias", "alice"); - properties.put("rs.security.keystore.password", "password"); - properties.put("rs.security.key.password", "password"); - properties.put("rs.security.keystore.file", - "org/apache/cxf/systest/jaxrs/security/certs/alice.jks"); - properties.put("rs.security.encryption.content.algorithm", "A128GCM"); - properties.put("rs.security.encryption.key.algorithm", "RSA-OAEP"); - properties.put("rs.security.encryption.include.cert", "true"); - WebClient.getConfig(client).getRequestContext().putAll(properties); - - // Failure expected as we are encrypting to "alice" instead of "bob" - Response response = client.post(new Book("book", 123L)); - assertNotEquals(response.getStatus(), 200); - } - - @org.junit.Test - public void testEncryptionIncludeCertSha1() throws Exception { - if (SKIP_AES_GCM_TESTS) { - return; - } - URL busFile = JweJwsReferenceTest.class.getResource("client.xml"); - - List<Object> providers = new ArrayList<Object>(); - providers.add(new JacksonJsonProvider()); - providers.add(new JweWriterInterceptor()); - - String address = "http://localhost:" + PORT + "/jweincludecert/bookstore/books"; - WebClient client = - WebClient.create(address, providers, busFile.toString()); - client.type("application/json").accept("application/json"); - - Map<String, Object> properties = new HashMap<String, Object>(); - properties.put("rs.security.keystore.type", "jks"); - properties.put("rs.security.keystore.alias", "bob"); - properties.put("rs.security.keystore.password", "password"); - properties.put("rs.security.key.password", "password"); - properties.put("rs.security.keystore.file", - "org/apache/cxf/systest/jaxrs/security/certs/bob.jks"); - properties.put("rs.security.encryption.content.algorithm", "A128GCM"); - properties.put("rs.security.encryption.key.algorithm", "RSA-OAEP"); - WebClient.getConfig(client).getRequestContext().putAll(properties); - - // First test that it fails without adding a cert (reference). This is because - // the service side does not have an alias configured - - Response response = client.post(new Book("book", 123L)); - assertNotEquals(response.getStatus(), 200); - - // Now it should work - properties.put("rs.security.encryption.include.cert.sha1", "true"); - WebClient.getConfig(client).getRequestContext().putAll(properties); - response = client.post(new Book("book", 123L)); - assertEquals(response.getStatus(), 200); - } - - @org.junit.Test - public void testEncryptionIncludeCertSha1NegativeTest() throws Exception { - if (SKIP_AES_GCM_TESTS) { - return; - } - URL busFile = JweJwsReferenceTest.class.getResource("client.xml"); - - List<Object> providers = new ArrayList<Object>(); - providers.add(new JacksonJsonProvider()); - providers.add(new JweWriterInterceptor()); - - String address = "http://localhost:" + PORT + "/jweincludecert/bookstore/books"; - WebClient client = - WebClient.create(address, providers, busFile.toString()); - client.type("application/json").accept("application/json"); - - Map<String, Object> properties = new HashMap<String, Object>(); - properties.put("rs.security.keystore.type", "jks"); - properties.put("rs.security.keystore.alias", "alice"); - properties.put("rs.security.keystore.password", "password"); - properties.put("rs.security.key.password", "password"); - properties.put("rs.security.keystore.file", - "org/apache/cxf/systest/jaxrs/security/certs/alice.jks"); - properties.put("rs.security.encryption.content.algorithm", "A128GCM"); - properties.put("rs.security.encryption.key.algorithm", "RSA-OAEP"); - properties.put("rs.security.encryption.include.cert.sha1", "true"); - WebClient.getConfig(client).getRequestContext().putAll(properties); - - // Failure expected as we are encrypting to "alice" instead of "bob" - Response response = client.post(new Book("book", 123L)); - assertNotEquals(response.getStatus(), 200); - } - - // - // Signature tests - // - - @org.junit.Test - public void testSignatureIncludeCert() throws Exception { - - URL busFile = JweJwsReferenceTest.class.getResource("client.xml"); - - List<Object> providers = new ArrayList<Object>(); - providers.add(new JacksonJsonProvider()); - providers.add(new JwsWriterInterceptor()); - - String address = "http://localhost:" + PORT + "/jwsincludecert/bookstore/books"; - WebClient client = - WebClient.create(address, providers, busFile.toString()); - client.type("application/json").accept("application/json"); - - Map<String, Object> properties = new HashMap<String, Object>(); - properties.put("rs.security.keystore.type", "jks"); - properties.put("rs.security.keystore.alias", "alice"); - properties.put("rs.security.keystore.password", "password"); - properties.put("rs.security.key.password", "password"); - properties.put("rs.security.keystore.file", - "org/apache/cxf/systest/jaxrs/security/certs/alice.jks"); - WebClient.getConfig(client).getRequestContext().putAll(properties); - - // First test that it fails without adding a cert (reference). This is because - // the service side does not have an alias configured - - Response response = client.post(new Book("book", 123L)); - assertNotEquals(response.getStatus(), 200); - - // Now it should work - properties.put("rs.security.signature.include.cert", "true"); - WebClient.getConfig(client).getRequestContext().putAll(properties); - response = client.post(new Book("book", 123L)); - assertEquals(response.getStatus(), 200); - } - - @org.junit.Test - public void testSignatureIncludeCertNegativeTest() throws Exception { - - - URL busFile = JweJwsReferenceTest.class.getResource("client.xml"); - - List<Object> providers = new ArrayList<Object>(); - providers.add(new JacksonJsonProvider()); - providers.add(new JwsWriterInterceptor()); - - String address = "http://localhost:" + PORT + "/jwsincludecert/bookstore/books"; - WebClient client = - WebClient.create(address, providers, busFile.toString()); - client.type("application/json").accept("application/json"); - - Map<String, Object> properties = new HashMap<String, Object>(); - properties.put("rs.security.keystore.type", "jks"); - properties.put("rs.security.keystore.alias", "morpit"); - properties.put("rs.security.keystore.password", "password"); - properties.put("rs.security.key.password", "password"); - properties.put("rs.security.keystore.file", - "org/apache/cxf/systest/jaxrs/security/certs/Morpit.jks"); - properties.put("rs.security.signature.include.cert", "true"); - WebClient.getConfig(client).getRequestContext().putAll(properties); - - // Failure expected as we are signing using a cert not trusted by cxfca.jks - Response response = client.post(new Book("book", 123L)); - assertNotEquals(response.getStatus(), 200); - } - - @org.junit.Test - public void testSignatureIncludeCertSha1() throws Exception { - - URL busFile = JweJwsReferenceTest.class.getResource("client.xml"); - - List<Object> providers = new ArrayList<Object>(); - providers.add(new JacksonJsonProvider()); - providers.add(new JwsWriterInterceptor()); - - String address = "http://localhost:" + PORT + "/jwsincludecertsha1/bookstore/books"; - WebClient client = - WebClient.create(address, providers, busFile.toString()); - client.type("application/json").accept("application/json"); - - Map<String, Object> properties = new HashMap<String, Object>(); - properties.put("rs.security.keystore.type", "jks"); - properties.put("rs.security.keystore.alias", "alice"); - properties.put("rs.security.keystore.password", "password"); - properties.put("rs.security.key.password", "password"); - properties.put("rs.security.keystore.file", - "org/apache/cxf/systest/jaxrs/security/certs/alice.jks"); - WebClient.getConfig(client).getRequestContext().putAll(properties); - - // First test that it fails without adding a cert (reference). This is because - // the service side does not have an alias configured - - Response response = client.post(new Book("book", 123L)); - assertNotEquals(response.getStatus(), 200); - - // Now it should work - properties.put("rs.security.signature.include.cert.sha1", "true"); - WebClient.getConfig(client).getRequestContext().putAll(properties); - response = client.post(new Book("book", 123L)); - assertEquals(response.getStatus(), 200); - } - - - @org.junit.Test - public void testSignatureIncludeCertSha1NegativeTest() throws Exception { - - URL busFile = JweJwsReferenceTest.class.getResource("client.xml"); - - List<Object> providers = new ArrayList<Object>(); - providers.add(new JacksonJsonProvider()); - providers.add(new JwsWriterInterceptor()); - - String address = "http://localhost:" + PORT + "/jwsincludecertsha1/bookstore/books"; - WebClient client = - WebClient.create(address, providers, busFile.toString()); - client.type("application/json").accept("application/json"); - - Map<String, Object> properties = new HashMap<String, Object>(); - properties.put("rs.security.keystore.type", "jks"); - properties.put("rs.security.keystore.alias", "morpit"); - properties.put("rs.security.keystore.password", "password"); - properties.put("rs.security.key.password", "password"); - properties.put("rs.security.keystore.file", - "org/apache/cxf/systest/jaxrs/security/certs/Morpit.jks"); - properties.put("rs.security.signature.include.cert.sha1", "true"); - WebClient.getConfig(client).getRequestContext().putAll(properties); - - // Failure expected as we are signing using a cert not trusted by cxfca.jks - Response response = client.post(new Book("book", 123L)); - assertNotEquals(response.getStatus(), 200); - } - -} http://git-wip-us.apache.org/repos/asf/cxf/blob/39d8444b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jwt/PrivateKeyPasswordProviderImpl.java ---------------------------------------------------------------------- diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jwt/PrivateKeyPasswordProviderImpl.java b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jwt/PrivateKeyPasswordProviderImpl.java deleted file mode 100644 index d9d7153..0000000 --- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jwt/PrivateKeyPasswordProviderImpl.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.cxf.systest.jaxrs.security.jwt; - -import java.util.Properties; - -import org.apache.cxf.rs.security.jose.common.PrivateKeyPasswordProvider; - -public class PrivateKeyPasswordProviderImpl implements PrivateKeyPasswordProvider { - - private String password = "password"; - public PrivateKeyPasswordProviderImpl() { - - } - public PrivateKeyPasswordProviderImpl(String password) { - this.password = password; - } - @Override - public char[] getPassword(Properties storeProperties) { - return password.toCharArray(); - } - -} - http://git-wip-us.apache.org/repos/asf/cxf/blob/39d8444b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jwt/algorithms-server.xml ---------------------------------------------------------------------- diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jwt/algorithms-server.xml b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jwt/algorithms-server.xml deleted file mode 100644 index faa2e35..0000000 --- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jwt/algorithms-server.xml +++ /dev/null @@ -1,113 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, -software distributed under the License is distributed on an -"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, either express or implied. See the License for the -specific language governing permissions and limitations -under the License. ---> -<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:http="http://cxf.apache.org/transports/http/configuration" xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration" xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:cxf="http://cxf.apache.org/core" xmlns:jaxrs="http://cxf.apache.org/jaxrs" xsi:schemaLocation=" http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd http://cxf.apache.org/transports/http-jetty/configuration http://cxf.apache.org/schemas/configuration/http-jetty.xsd http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd "> - <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/> - <cxf:bus> - <cxf:features> - <cxf:logging/> - </cxf:features> - </cxf:bus> - - <bean id="serviceBean" class="org.apache.cxf.systest.jaxrs.security.jwt.BookStore"/> - - <bean id="jweInFilter" class="org.apache.cxf.rs.security.jose.jaxrs.JweContainerRequestFilter"/> - - <jaxrs:server address="http://localhost:${testutil.ports.jaxrs-jwejws-algorithms}/jweoaepgcm"> - <jaxrs:serviceBeans> - <ref bean="serviceBean"/> - </jaxrs:serviceBeans> - <jaxrs:providers> - <ref bean="jweInFilter"/> - </jaxrs:providers> - <jaxrs:properties> - <entry key="rs.security.encryption.in.properties" - value="org/apache/cxf/systest/jaxrs/security/alice.jwk.properties"/> - </jaxrs:properties> - </jaxrs:server> - - <jaxrs:server address="http://localhost:${testutil.ports.jaxrs-jwejws-algorithms}/jwesmallkey"> - <jaxrs:serviceBeans> - <ref bean="serviceBean"/> - </jaxrs:serviceBeans> - <jaxrs:providers> - <ref bean="jweInFilter"/> - </jaxrs:providers> - <jaxrs:properties> - <entry key="rs.security.keystore.type" value="jks"/> - <entry key="rs.security.keystore.alias" value="smallkey"/> - <entry key="rs.security.keystore.password" value="security"/> - <entry key="rs.security.key.password" value="security"/> - <entry key="rs.security.keystore.file" - value="org/apache/cxf/systest/jaxrs/security/certs/smallkeysize.jks"/> - <entry key="rs.security.encryption.content.algorithm" value="A128GCM"/> - <entry key="rs.security.encryption.key.algorithm" value="RSA-OAEP"/> - </jaxrs:properties> - </jaxrs:server> - - <bean id="jwsInFilter" class="org.apache.cxf.rs.security.jose.jaxrs.JwsContainerRequestFilter"/> - - <jaxrs:server address="http://localhost:${testutil.ports.jaxrs-jwejws-algorithms}/jws"> - <jaxrs:serviceBeans> - <ref bean="serviceBean"/> - </jaxrs:serviceBeans> - <jaxrs:providers> - <ref bean="jwsInFilter"/> - </jaxrs:providers> - <jaxrs:properties> - <entry key="rs.security.signature.in.properties" - value="org/apache/cxf/systest/jaxrs/security/bob.jwk.properties"/> - </jaxrs:properties> - </jaxrs:server> - - <jaxrs:server address="http://localhost:${testutil.ports.jaxrs-jwejws-algorithms}/jwsec"> - <jaxrs:serviceBeans> - <ref bean="serviceBean"/> - </jaxrs:serviceBeans> - <jaxrs:providers> - <ref bean="jwsInFilter"/> - </jaxrs:providers> - <jaxrs:properties> - <entry key="rs.security.keystore.type" value="jwk"/> - <entry key="rs.security.keystore.alias" value="ECKey"/> - <entry key="rs.security.keystore.file" - value="org/apache/cxf/systest/jaxrs/security/certs/jwkPublicSet.txt"/> - <entry key="rs.security.signature.algorithm" value="ES256"/> - </jaxrs:properties> - </jaxrs:server> - - <jaxrs:server address="http://localhost:${testutil.ports.jaxrs-jwejws-algorithms}/jwssmallkey"> - <jaxrs:serviceBeans> - <ref bean="serviceBean"/> - </jaxrs:serviceBeans> - <jaxrs:providers> - <ref bean="jwsInFilter"/> - </jaxrs:providers> - <jaxrs:properties> - <entry key="rs.security.keystore.type" value="jks"/> - <entry key="rs.security.keystore.alias" value="smallkey"/> - <entry key="rs.security.keystore.password" value="security"/> - <entry key="rs.security.key.password" value="security"/> - <entry key="rs.security.keystore.file" - value="org/apache/cxf/systest/jaxrs/security/certs/smallkeysize.jks"/> - <entry key="rs.security.signature.algorithm" value="RS256"/> - </jaxrs:properties> - </jaxrs:server> - -</beans> http://git-wip-us.apache.org/repos/asf/cxf/blob/39d8444b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jwt/client.xml ---------------------------------------------------------------------- diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jwt/client.xml b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jwt/client.xml deleted file mode 100644 index 13eaea1..0000000 --- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jwt/client.xml +++ /dev/null @@ -1,38 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. ---> -<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:http="http://cxf.apache.org/transports/http/configuration" xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:cxf="http://cxf.apache.org/core" xmlns:p="http://cxf.apache.org/policy" xmlns:sec="http://cxf.apache.org/configuration/security" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd http://cxf.apache.org/policy http://cxf.apache.org/schemas/poli cy.xsd"> - <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/> - <cxf:bus> - <cxf:features> - <cxf:logging/> - </cxf:features> - </cxf:bus> - <http:conduit name="https://localhost.*"> - <http:client ConnectionTimeout="3000000" ReceiveTimeout="3000000"/> - <http:tlsClientParameters disableCNCheck="true"> - <sec:keyManagers keyPassword="password"> - <sec:keyStore type="JKS" password="password" file="src/test/java/org/apache/cxf/systest/http/resources/Morpit.jks"/> - </sec:keyManagers> - <sec:trustManagers> - <sec:keyStore type="JKS" password="password" file="src/test/java/org/apache/cxf/systest/http/resources/Truststore.jks"/> - </sec:trustManagers> - </http:tlsClientParameters> - </http:conduit> -</beans> http://git-wip-us.apache.org/repos/asf/cxf/blob/39d8444b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jwt/reference-server.xml ---------------------------------------------------------------------- diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jwt/reference-server.xml b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jwt/reference-server.xml deleted file mode 100644 index a488f4e..0000000 --- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jwt/reference-server.xml +++ /dev/null @@ -1,101 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, -software distributed under the License is distributed on an -"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, either express or implied. See the License for the -specific language governing permissions and limitations -under the License. ---> -<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:http="http://cxf.apache.org/transports/http/configuration" xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration" xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:cxf="http://cxf.apache.org/core" xmlns:jaxrs="http://cxf.apache.org/jaxrs" xsi:schemaLocation=" http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd http://cxf.apache.org/transports/http-jetty/configuration http://cxf.apache.org/schemas/configuration/http-jetty.xsd http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd "> - <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/> - <cxf:bus> - <cxf:features> - <cxf:logging/> - </cxf:features> - </cxf:bus> - - <bean id="serviceBean" class="org.apache.cxf.systest.jaxrs.security.jwt.BookStore"/> - - <bean id="jweInFilter" class="org.apache.cxf.rs.security.jose.jaxrs.JweContainerRequestFilter"/> - - <jaxrs:server address="http://localhost:${testutil.ports.jaxrs-jwejws-reference}/jweincludekey"> - <jaxrs:serviceBeans> - <ref bean="serviceBean"/> - </jaxrs:serviceBeans> - <jaxrs:providers> - <ref bean="jweInFilter"/> - </jaxrs:providers> - <jaxrs:properties> - <entry key="rs.security.keystore.type" value="jwk"/> - <entry key="rs.security.keystore.file" - value="org/apache/cxf/systest/jaxrs/security/certs/jwkPrivateSet.txt"/> - <entry key="rs.security.encryption.content.algorithm" value="A128GCM"/> - <entry key="rs.security.encryption.key.algorithm" value="RSA-OAEP"/> - </jaxrs:properties> - </jaxrs:server> - - <bean id="passwordProvider" - class="org.apache.cxf.systest.jaxrs.security.jwt.PrivateKeyPasswordProviderImpl"/> - - <jaxrs:server address="http://localhost:${testutil.ports.jaxrs-jwejws-reference}/jweincludecert"> - <jaxrs:serviceBeans> - <ref bean="serviceBean"/> - </jaxrs:serviceBeans> - <jaxrs:providers> - <ref bean="jweInFilter"/> - </jaxrs:providers> - <jaxrs:properties> - <entry key="rs.security.keystore.type" value="jks"/> - <entry key="rs.security.keystore.file" - value="org/apache/cxf/systest/jaxrs/security/certs/bob.jks"/> - <entry key="rs.security.keystore.password" value="password"/> - <entry key="rs.security.decryption.key.password.provider" value-ref="passwordProvider"/> - <entry key="rs.security.encryption.content.algorithm" value="A128GCM"/> - <entry key="rs.security.encryption.key.algorithm" value="RSA-OAEP"/> - </jaxrs:properties> - </jaxrs:server> - - <bean id="jwsInFilter" class="org.apache.cxf.rs.security.jose.jaxrs.JwsContainerRequestFilter"/> - - <jaxrs:server address="http://localhost:${testutil.ports.jaxrs-jwejws-reference}/jwsincludecert"> - <jaxrs:serviceBeans> - <ref bean="serviceBean"/> - </jaxrs:serviceBeans> - <jaxrs:providers> - <ref bean="jwsInFilter"/> - </jaxrs:providers> - <jaxrs:properties> - <entry key="rs.security.keystore.type" value="jks"/> - <entry key="rs.security.keystore.file" - value="org/apache/cxf/systest/jaxrs/security/certs/cxfca.jks"/> - <entry key="rs.security.keystore.password" value="password"/> - </jaxrs:properties> - </jaxrs:server> - - <jaxrs:server address="http://localhost:${testutil.ports.jaxrs-jwejws-reference}/jwsincludecertsha1"> - <jaxrs:serviceBeans> - <ref bean="serviceBean"/> - </jaxrs:serviceBeans> - <jaxrs:providers> - <ref bean="jwsInFilter"/> - </jaxrs:providers> - <jaxrs:properties> - <entry key="rs.security.keystore.type" value="jks"/> - <entry key="rs.security.keystore.file" - value="org/apache/cxf/systest/jaxrs/security/certs/alice.jks"/> - <entry key="rs.security.keystore.password" value="password"/> - </jaxrs:properties> - </jaxrs:server> - -</beans> http://git-wip-us.apache.org/repos/asf/cxf/blob/39d8444b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jwt/server.xml ---------------------------------------------------------------------- diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jwt/server.xml b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jwt/server.xml deleted file mode 100644 index 9923948..0000000 --- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jwt/server.xml +++ /dev/null @@ -1,246 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, -software distributed under the License is distributed on an -"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, either express or implied. See the License for the -specific language governing permissions and limitations -under the License. ---> -<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:http="http://cxf.apache.org/transports/http/configuration" xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration" xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:cxf="http://cxf.apache.org/core" xmlns:jaxrs="http://cxf.apache.org/jaxrs" xsi:schemaLocation=" http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd http://cxf.apache.org/transports/http-jetty/configuration http://cxf.apache.org/schemas/configuration/http-jetty.xsd http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd "> - <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/> - <cxf:bus> - <cxf:features> - <cxf:logging/> - </cxf:features> - </cxf:bus> - <httpj:engine-factory id="port-9095-tls-config"> - <httpj:engine port="${testutil.ports.jaxrs-jwt}"> - <httpj:tlsServerParameters> - <sec:keyManagers keyPassword="password"> - <sec:keyStore type="JKS" password="password" file="src/test/java/org/apache/cxf/systest/http/resources/Bethal.jks"/> - </sec:keyManagers> - <sec:trustManagers> - <sec:keyStore type="JKS" password="password" file="src/test/java/org/apache/cxf/systest/http/resources/Truststore.jks"/> - </sec:trustManagers> - <sec:clientAuthentication want="true" required="true"/> - </httpj:tlsServerParameters> - </httpj:engine> - </httpj:engine-factory> - <bean id="serviceBean" class="org.apache.cxf.systest.jaxrs.security.jwt.BookStore"/> - <bean id="jweInFilter" class="org.apache.cxf.rs.security.jose.jaxrs.JweContainerRequestFilter"/> - <bean id="jweOutFilter" class="org.apache.cxf.rs.security.jose.jaxrs.JweWriterInterceptor"/> - - <bean id="aesWrapEncryptionAlgo" class="org.apache.cxf.rs.security.jose.jwe.AesWrapKeyEncryptionAlgorithm"> - <constructor-arg type="java.lang.String" value="GawgguFyGrWKav7AX4VKUg"/> - <constructor-arg value="A128KW"/> - </bean> - <bean id="aesCbcHmacEncryption" class="org.apache.cxf.rs.security.jose.jwe.AesCbcHmacJweEncryption"> - <constructor-arg value="A128CBC-HS256"/> - <constructor-arg ref="aesWrapEncryptionAlgo"/> - </bean> - - <bean id="aesWrapDecryptionAlgo" class="org.apache.cxf.rs.security.jose.jwe.AesWrapKeyDecryptionAlgorithm"> - <constructor-arg value="GawgguFyGrWKav7AX4VKUg"/> - </bean> - <bean id="aesCbcHmacDecryption" class="org.apache.cxf.rs.security.jose.jwe.AesCbcHmacJweDecryption"> - <constructor-arg ref="aesWrapDecryptionAlgo"/> - </bean> - - <bean id="jweInAesCbcHmacFilter" class="org.apache.cxf.rs.security.jose.jaxrs.JweContainerRequestFilter"> - <property name="decryptionProvider" ref="aesCbcHmacDecryption"/> - </bean> - <bean id="jweOutAesCbcHmacFilter" class="org.apache.cxf.rs.security.jose.jaxrs.JweWriterInterceptor"> - <property name="encryptionProvider" ref="aesCbcHmacEncryption"/> - </bean> - - <bean id="hmacSigVerifier" class="org.apache.cxf.rs.security.jose.jws.HmacJwsSignatureVerifier"> - <constructor-arg type="java.lang.String" value="AyM1SysPpbyDfgZld3umj1qzKObwVMkoqQ-EstJQLr_T-1qS0gZH75aKtMN3Yj0iPS4hcgUuTwjAzZr1Z9CAow"/> - <constructor-arg value="HS256"/> - </bean> - <bean id="jwsHmacInFilter" class="org.apache.cxf.rs.security.jose.jaxrs.JwsContainerRequestFilter"> - <property name="signatureVerifier" ref="hmacSigVerifier"/> - </bean> - <bean id="jwsInFilter" class="org.apache.cxf.rs.security.jose.jaxrs.JwsContainerRequestFilter"/> - <bean id="jwsOutFilter" class="org.apache.cxf.rs.security.jose.jaxrs.JwsWriterInterceptor"/> - <bean id="keyPasswordProvider" class="org.apache.cxf.systest.jaxrs.security.jwt.PrivateKeyPasswordProviderImpl"/> - <bean id="keyPasswordProvider2" class="org.apache.cxf.systest.jaxrs.security.jwt.PrivateKeyPasswordProviderImpl"> - <constructor-arg value="Thus from my lips, by yours, my sin is purged."/> - </bean> - <jaxrs:server address="https://localhost:${testutil.ports.jaxrs-jwt}/jwejwsrsa"> - <jaxrs:serviceBeans> - <ref bean="serviceBean"/> - </jaxrs:serviceBeans> - <jaxrs:providers> - <ref bean="jweInFilter"/> - <ref bean="jweOutFilter"/> - <ref bean="jwsInFilter"/> - <ref bean="jwsOutFilter"/> - </jaxrs:providers> - <jaxrs:properties> - <entry key="rs.security.encryption.in.properties" value="org/apache/cxf/systest/jaxrs/security/alice.rs.properties"/> - <entry key="rs.security.signature.in.properties" value="org/apache/cxf/systest/jaxrs/security/bob.rs.properties"/> - <entry key="rs.security.encryption.out.properties" value="org/apache/cxf/systest/jaxrs/security/bob.rs.properties"/> - <entry key="rs.security.signature.out.properties" value="org/apache/cxf/systest/jaxrs/security/alice.rs.properties"/> - <entry key="rs.security.signature.key.password.provider" value-ref="keyPasswordProvider"/> - <entry key="rs.security.decryption.key.password.provider" value-ref="keyPasswordProvider"/> - </jaxrs:properties> - </jaxrs:server> - <jaxrs:server address="https://localhost:${testutil.ports.jaxrs-jwt}/jwejwsrsacert"> - <jaxrs:serviceBeans> - <ref bean="serviceBean"/> - </jaxrs:serviceBeans> - <jaxrs:providers> - <ref bean="jweInFilter"/> - <ref bean="jweOutFilter"/> - <ref bean="jwsInFilter"/> - <ref bean="jwsOutFilter"/> - </jaxrs:providers> - <jaxrs:properties> - <entry key="rs.security.encryption.in.properties" value="org/apache/cxf/systest/jaxrs/security/alice.rs.properties"/> - <entry key="rs.security.signature.out.properties" value="org/apache/cxf/systest/jaxrs/security/alice.rs.properties"/> - <entry key="rs.security.keystore.file" value="org/apache/cxf/systest/jaxrs/security/certs/jwkPublicSet.txt"/> - <entry key="rs.security.keystore.alias.jwe.out" value="BobCert"/> - <entry key="rs.security.keystore.alias.jws.in" value="BobCert"/> - <entry key="rs.security.signature.key.password.provider" value-ref="keyPasswordProvider"/> - <entry key="rs.security.decryption.key.password.provider" value-ref="keyPasswordProvider"/> - </jaxrs:properties> - </jaxrs:server> - <jaxrs:server address="https://localhost:${testutil.ports.jaxrs-jwt}/jwejwsrsaCertInHeaders"> - <jaxrs:serviceBeans> - <ref bean="serviceBean"/> - </jaxrs:serviceBeans> - <jaxrs:providers> - <ref bean="jweInFilter"/> - <ref bean="jweOutFilter"/> - <ref bean="jwsInFilter"/> - <ref bean="jwsOutFilter"/> - </jaxrs:providers> - <jaxrs:properties> - <entry key="rs.security.encryption.in.properties" value="org/apache/cxf/systest/jaxrs/security/alice.rs.storeonly.properties"/> - <entry key="rs.security.signature.in.properties" value="org/apache/cxf/systest/jaxrs/security/bob.rs.storeonly.properties"/> - <entry key="rs.security.encryption.out.properties" value="org/apache/cxf/systest/jaxrs/security/bob.rs.properties"/> - <entry key="rs.security.signature.out.properties" value="org/apache/cxf/systest/jaxrs/security/alice.rs.properties"/> - <entry key="rs.security.signature.key.password.provider" value-ref="keyPasswordProvider"/> - <entry key="rs.security.decryption.key.password.provider" value-ref="keyPasswordProvider"/> - </jaxrs:properties> - </jaxrs:server> - <bean id="jackson" class="com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider"/> - <jaxrs:server address="https://localhost:${testutil.ports.jaxrs-jwt}/jwejwkrsa"> - <jaxrs:serviceBeans> - <ref bean="serviceBean"/> - </jaxrs:serviceBeans> - <jaxrs:providers> - <ref bean="jweInFilter"/> - <ref bean="jweOutFilter"/> - <ref bean="jackson"/> - </jaxrs:providers> - <jaxrs:properties> - <entry key="rs.security.encryption.in.properties" value="org/apache/cxf/systest/jaxrs/security/alice.jwk.properties"/> - <entry key="rs.security.encryption.out.properties" value="org/apache/cxf/systest/jaxrs/security/bob.jwk.properties"/> - </jaxrs:properties> - </jaxrs:server> - <jaxrs:server address="https://localhost:${testutil.ports.jaxrs-jwt}/jwejwkaeswrap"> - <jaxrs:serviceBeans> - <ref bean="serviceBean"/> - </jaxrs:serviceBeans> - <jaxrs:providers> - <ref bean="jweInFilter"/> - <ref bean="jweOutFilter"/> - </jaxrs:providers> - <jaxrs:properties> - <entry key="rs.security.encryption.properties" value="org/apache/cxf/systest/jaxrs/security/secret.jwk.properties"/> - </jaxrs:properties> - </jaxrs:server> - <jaxrs:server address="https://localhost:${testutil.ports.jaxrs-jwt}/jwejwkaescbchmac"> - <jaxrs:serviceBeans> - <ref bean="serviceBean"/> - </jaxrs:serviceBeans> - <jaxrs:providers> - <ref bean="jweInFilter"/> - <ref bean="jweOutFilter"/> - </jaxrs:providers> - <jaxrs:properties> - <entry key="rs.security.encryption.properties" value="org/apache/cxf/systest/jaxrs/security/secret.aescbchmac.properties"/> - <entry key="rs.security.decryption.key.password.provider" value-ref="keyPasswordProvider2"/> - </jaxrs:properties> - </jaxrs:server> - <jaxrs:server address="https://localhost:${testutil.ports.jaxrs-jwt}/jwejwshmac"> - <jaxrs:serviceBeans> - <ref bean="serviceBean"/> - </jaxrs:serviceBeans> - <jaxrs:providers> - <ref bean="jweInFilter"/> - <ref bean="jweOutFilter"/> - <ref bean="jwsHmacInFilter"/> - <ref bean="jwsOutFilter"/> - <ref bean="jackson"/> - </jaxrs:providers> - <jaxrs:properties> - <entry key="rs.security.encryption.in.properties" value="org/apache/cxf/systest/jaxrs/security/alice.rs.properties"/> - <entry key="rs.security.encryption.out.properties" value="org/apache/cxf/systest/jaxrs/security/bob.rs.properties"/> - <entry key="rs.security.signature.out.properties" value="org/apache/cxf/systest/jaxrs/security/alice.rs.properties"/> - <entry key="rs.security.signature.key.password.provider" value-ref="keyPasswordProvider"/> - <entry key="rs.security.decryption.key.password.provider" value-ref="keyPasswordProvider"/> - </jaxrs:properties> - </jaxrs:server> - <jaxrs:server address="https://localhost:${testutil.ports.jaxrs-jwt}/jwsjwkhmac"> - <jaxrs:serviceBeans> - <ref bean="serviceBean"/> - </jaxrs:serviceBeans> - <jaxrs:providers> - <ref bean="jwsInFilter"/> - <ref bean="jwsOutFilter"/> - <ref bean="jackson"/> - </jaxrs:providers> - <jaxrs:properties> - <entry key="rs.security.signature.properties" value="org/apache/cxf/systest/jaxrs/security/secret.jwk.properties"/> - </jaxrs:properties> - </jaxrs:server> - <jaxrs:server address="https://localhost:${testutil.ports.jaxrs-jwt}/jwsjwkec"> - <jaxrs:serviceBeans> - <ref bean="serviceBean"/> - </jaxrs:serviceBeans> - <jaxrs:providers> - <ref bean="jwsInFilter"/> - <ref bean="jwsOutFilter"/> - </jaxrs:providers> - <jaxrs:properties> - <entry key="rs.security.signature.in.properties" value="org/apache/cxf/systest/jaxrs/security/jws.ec.public.properties"/> - <entry key="rs.security.signature.out.properties" value="org/apache/cxf/systest/jaxrs/security/jws.ec.private.properties"/> - </jaxrs:properties> - </jaxrs:server> - <jaxrs:server address="https://localhost:${testutil.ports.jaxrs-jwt}/jwsjwkrsa"> - <jaxrs:serviceBeans> - <ref bean="serviceBean"/> - </jaxrs:serviceBeans> - <jaxrs:providers> - <ref bean="jwsInFilter"/> - <ref bean="jwsOutFilter"/> - </jaxrs:providers> - <jaxrs:properties> - <entry key="rs.security.signature.in.properties" value="org/apache/cxf/systest/jaxrs/security/bob.jwk.properties"/> - <entry key="rs.security.signature.out.properties" value="org/apache/cxf/systest/jaxrs/security/alice.jwk.properties"/> - <entry key="rs.security.accept.public.key" value="true"/> - </jaxrs:properties> - </jaxrs:server> - <jaxrs:server address="https://localhost:${testutil.ports.jaxrs-jwt}/jweaescbchmac"> - <jaxrs:serviceBeans> - <ref bean="serviceBean"/> - </jaxrs:serviceBeans> - <jaxrs:providers> - <ref bean="jweInAesCbcHmacFilter"/> - <ref bean="jweOutAesCbcHmacFilter"/> - </jaxrs:providers> - </jaxrs:server> -</beans> http://git-wip-us.apache.org/repos/asf/cxf/blob/39d8444b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jwt/serverJwsJson.xml ---------------------------------------------------------------------- diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jwt/serverJwsJson.xml b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jwt/serverJwsJson.xml deleted file mode 100644 index 1d2dd37..0000000 --- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jwt/serverJwsJson.xml +++ /dev/null @@ -1,90 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, -software distributed under the License is distributed on an -"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, either express or implied. See the License for the -specific language governing permissions and limitations -under the License. ---> -<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:http="http://cxf.apache.org/transports/http/configuration" xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration" xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:cxf="http://cxf.apache.org/core" xmlns:jaxrs="http://cxf.apache.org/jaxrs" xsi:schemaLocation=" http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd http://cxf.apache.org/transports/http-jetty/configuration http://cxf.apache.org/schemas/configuration/http-jetty.xsd http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd "> - <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/> - <cxf:bus> - <cxf:features> - <cxf:logging/> - </cxf:features> - </cxf:bus> - <httpj:engine-factory id="port-9095-tls-config"> - <httpj:engine port="${testutil.ports.jaxrs-jws-json}"> - <httpj:tlsServerParameters> - <sec:keyManagers keyPassword="password"> - <sec:keyStore type="JKS" password="password" file="src/test/java/org/apache/cxf/systest/http/resources/Bethal.jks"/> - </sec:keyManagers> - <sec:trustManagers> - <sec:keyStore type="JKS" password="password" file="src/test/java/org/apache/cxf/systest/http/resources/Truststore.jks"/> - </sec:trustManagers> - <sec:clientAuthentication want="true" required="true"/> - </httpj:tlsServerParameters> - </httpj:engine> - </httpj:engine-factory> - - <bean id="serviceBean" class="org.apache.cxf.systest.jaxrs.security.jwt.BookStore"/> - <bean id="jwsInFilter" class="org.apache.cxf.rs.security.jose.jaxrs.JwsJsonContainerRequestFilter"/> - <bean id="jwsOutFilter" class="org.apache.cxf.rs.security.jose.jaxrs.JwsJsonWriterInterceptor"/> - <bean id="jackson" class="com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider"/> - <jaxrs:server address="https://localhost:${testutil.ports.jaxrs-jws-json}/jwsjsonhmac"> - <jaxrs:serviceBeans> - <ref bean="serviceBean"/> - </jaxrs:serviceBeans> - <jaxrs:providers> - <ref bean="jwsInFilter"/> - <ref bean="jwsOutFilter"/> - <ref bean="jackson"/> - </jaxrs:providers> - <jaxrs:properties> - <entry key="rs.security.signature.list.properties" value="org/apache/cxf/systest/jaxrs/security/secret.jwk.properties"/> - </jaxrs:properties> - </jaxrs:server> - <bean id="jweInFilter" class="org.apache.cxf.rs.security.jose.jaxrs.JweContainerRequestFilter"/> - <bean id="jweOutFilter" class="org.apache.cxf.rs.security.jose.jaxrs.JweWriterInterceptor"/> - <jaxrs:server address="https://localhost:${testutil.ports.jaxrs-jws-json}/jwejwsjsonhmac"> - <jaxrs:serviceBeans> - <ref bean="serviceBean"/> - </jaxrs:serviceBeans> - <jaxrs:providers> - <ref bean="jwsInFilter"/> - <ref bean="jwsOutFilter"/> - <ref bean="jweInFilter"/> - <ref bean="jweOutFilter"/> - <ref bean="jackson"/> - </jaxrs:providers> - <jaxrs:properties> - <entry key="rs.security.signature.list.properties" value="org/apache/cxf/systest/jaxrs/security/secret.jwk.properties"/> - <entry key="rs.security.encryption.properties" value="org/apache/cxf/systest/jaxrs/security/secret.jwk.properties"/> - </jaxrs:properties> - </jaxrs:server> - <jaxrs:server address="https://localhost:${testutil.ports.jaxrs-jws-json}/jwsjsonhmac2"> - <jaxrs:serviceBeans> - <ref bean="serviceBean"/> - </jaxrs:serviceBeans> - <jaxrs:providers> - <ref bean="jwsInFilter"/> - <ref bean="jwsOutFilter"/> - </jaxrs:providers> - <jaxrs:properties> - <entry key="rs.security.signature.list.properties" - value="org/apache/cxf/systest/jaxrs/security/secret.jwk.properties,org/apache/cxf/systest/jaxrs/security/secret.jwk.hmac.properties"/> - </jaxrs:properties> - </jaxrs:server> - -</beans> http://git-wip-us.apache.org/repos/asf/cxf/blob/39d8444b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/BookServerOAuth2.java ---------------------------------------------------------------------- diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/BookServerOAuth2.java b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/BookServerOAuth2.java index 9f2565d..a658e35 100644 --- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/BookServerOAuth2.java +++ b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/BookServerOAuth2.java @@ -19,6 +19,8 @@ package org.apache.cxf.systest.jaxrs.security.oauth2; +import java.net.URL; + import org.apache.cxf.Bus; import org.apache.cxf.BusFactory; import org.apache.cxf.bus.spring.SpringBusFactory; @@ -27,8 +29,8 @@ import org.apache.cxf.testutil.common.TestUtil; public class BookServerOAuth2 extends AbstractBusTestServerBase { public static final String PORT = TestUtil.getPortNumber("jaxrs-oauth2"); - private static final String SERVER_CONFIG_FILE = - "org/apache/cxf/systest/jaxrs/security/oauth2/server.xml"; + private static final URL SERVER_CONFIG_FILE = + BookServerOAuth2.class.getResource("server.xml"); protected void run() { SpringBusFactory bf = new SpringBusFactory(); http://git-wip-us.apache.org/repos/asf/cxf/blob/39d8444b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/client.xml ---------------------------------------------------------------------- diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/client.xml b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/client.xml deleted file mode 100644 index 13eaea1..0000000 --- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/client.xml +++ /dev/null @@ -1,38 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. ---> -<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:http="http://cxf.apache.org/transports/http/configuration" xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:cxf="http://cxf.apache.org/core" xmlns:p="http://cxf.apache.org/policy" xmlns:sec="http://cxf.apache.org/configuration/security" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd http://cxf.apache.org/policy http://cxf.apache.org/schemas/poli cy.xsd"> - <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/> - <cxf:bus> - <cxf:features> - <cxf:logging/> - </cxf:features> - </cxf:bus> - <http:conduit name="https://localhost.*"> - <http:client ConnectionTimeout="3000000" ReceiveTimeout="3000000"/> - <http:tlsClientParameters disableCNCheck="true"> - <sec:keyManagers keyPassword="password"> - <sec:keyStore type="JKS" password="password" file="src/test/java/org/apache/cxf/systest/http/resources/Morpit.jks"/> - </sec:keyManagers> - <sec:trustManagers> - <sec:keyStore type="JKS" password="password" file="src/test/java/org/apache/cxf/systest/http/resources/Truststore.jks"/> - </sec:trustManagers> - </http:tlsClientParameters> - </http:conduit> -</beans>
