cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: [CXF-7365] Adding RSA test
Date Mon, 08 May 2017 16:13:20 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.1.x-fixes c99f15ce3 -> ea68b9ad9


[CXF-7365] Adding RSA test


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

Branch: refs/heads/3.1.x-fixes
Commit: ea68b9ad926131b73effcb554499625a6cf9e837
Parents: c99f15c
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Mon May 8 17:11:48 2017 +0100
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Mon May 8 17:12:59 2017 +0100

----------------------------------------------------------------------
 .../jose/jwejws/JAXRSJwsMultipartTest.java      | 39 +++++++++++++++-----
 .../security/jose/jwejws/serverMultipart.xml    | 11 ++++++
 2 files changed, 41 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/ea68b9ad/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jose/jwejws/JAXRSJwsMultipartTest.java
----------------------------------------------------------------------
diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jose/jwejws/JAXRSJwsMultipartTest.java
b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jose/jwejws/JAXRSJwsMultipartTest.java
index bab7b25..ed60ee8 100644
--- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jose/jwejws/JAXRSJwsMultipartTest.java
+++ b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jose/jwejws/JAXRSJwsMultipartTest.java
@@ -64,15 +64,25 @@ public class JAXRSJwsMultipartTest extends AbstractBusClientServerTestBase
{
     @Test
     public void testJwsJwkBookHMacMultipart() throws Exception {
         String address = "https://localhost:" + PORT + "/jwsjwkhmacSinglePart";
-        BookStore bs = createJwsBookStoreMultipart(address, true);
+        BookStore bs = createJwsBookStoreHMac(address, true);
         Book book = bs.echoBookMultipart(new Book("book", 123L));
         assertEquals("book", book.getName());
         assertEquals(123L, book.getId());
     }
+    
+    @Test
+    public void testJwsJwkBookRSAMultipart() throws Exception {
+        String address = "https://localhost:" + PORT + "/jwsjwkrsaSinglePart";
+        BookStore bs = createJwsBookStoreRSA(address, true);
+        Book book = bs.echoBookMultipart(new Book("book", 123L));
+        assertEquals("book", book.getName());
+        assertEquals(123L, book.getId());
+    }
+    
     @Test
     public void testJwsJwkBooksHMacMultipart() throws Exception {
         String address = "https://localhost:" + PORT + "/jwsjwkhmacManyParts";
-        BookStore bs = createJwsBookStoreMultipart(address, false);
+        BookStore bs = createJwsBookStoreHMac(address, false);
         List<Book> books = new LinkedList<Book>();
         books.add(new Book("book", 123L));
         books.add(new Book("book2", 124L));
@@ -85,7 +95,7 @@ public class JAXRSJwsMultipartTest extends AbstractBusClientServerTestBase
{
     @Test(expected = ProcessingException.class)
     public void testJwsJwkBooksHMacMultipartClientRestriction() throws Exception {
         String address = "https://localhost:" + PORT + "/jwsjwkhmacManyParts";
-        BookStore bs = createJwsBookStoreMultipart(address, true);
+        BookStore bs = createJwsBookStoreHMac(address, true);
         List<Book> books = new LinkedList<Book>();
         books.add(new Book("book", 123L));
         books.add(new Book("book2", 124L));
@@ -94,7 +104,7 @@ public class JAXRSJwsMultipartTest extends AbstractBusClientServerTestBase
{
     @Test(expected = BadRequestException.class)
     public void testJwsJwkBooksHMacMultipartServerRestriction() throws Exception {
         String address = "https://localhost:" + PORT + "/jwsjwkhmacSinglePart";
-        BookStore bs = createJwsBookStoreMultipart(address, false);
+        BookStore bs = createJwsBookStoreHMac(address, false);
         List<Book> books = new LinkedList<Book>();
         books.add(new Book("book", 123L));
         books.add(new Book("book2", 124L));
@@ -111,7 +121,7 @@ public class JAXRSJwsMultipartTest extends AbstractBusClientServerTestBase
{
     @Test
     public void testJwsJwkBookHMacMultipartModified() throws Exception {
         String address = "https://localhost:" + PORT + "/jwsjwkhmacSinglePartModified";
-        BookStore bs = createJwsBookStoreMultipart(address, true);
+        BookStore bs = createJwsBookStoreHMac(address, true);
         try {
             bs.echoBookMultipart(new Book("book", 123L));
             fail("Exception is expected");
@@ -119,7 +129,20 @@ public class JAXRSJwsMultipartTest extends AbstractBusClientServerTestBase
{
             // expected
         }
     }
-    private BookStore createJwsBookStoreMultipart(String address, boolean supportSinglePart)
throws Exception {
+    private BookStore createJwsBookStoreHMac(String address, boolean supportSinglePart) throws
Exception {
+        JAXRSClientFactoryBean bean = createJAXRSClientFactoryBean(address, supportSinglePart);
+        bean.getProperties(true).put("rs.security.signature.properties",
+            "org/apache/cxf/systest/jaxrs/security/secret.jwk.properties");
+        return bean.create(BookStore.class);
+    }
+    private BookStore createJwsBookStoreRSA(String address, boolean supportSinglePart) throws
Exception {
+        JAXRSClientFactoryBean bean = createJAXRSClientFactoryBean(address, supportSinglePart);
+        bean.getProperties(true).put("rs.security.signature.properties",
+            "org/apache/cxf/systest/jaxrs/security/alice.jwk.properties");
+        return bean.create(BookStore.class);
+    }
+    private JAXRSClientFactoryBean createJAXRSClientFactoryBean(String address, 
+                                                                boolean supportSinglePart)
throws Exception {
         JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
         SpringBusFactory bf = new SpringBusFactory();
         URL busFile = JAXRSJwsMultipartTest.class.getResource("client.xml");
@@ -133,8 +156,6 @@ public class JAXRSJwsMultipartTest extends AbstractBusClientServerTestBase
{
         providers.add(filter);
         providers.add(new JwsMultipartSignatureProvider());
         bean.setProviders(providers);
-        bean.getProperties(true).put("rs.security.signature.properties",
-            "org/apache/cxf/systest/jaxrs/security/secret.jwk.properties");
-        return bean.create(BookStore.class);
+        return bean;
     }
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/ea68b9ad/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/jose/jwejws/serverMultipart.xml
----------------------------------------------------------------------
diff --git a/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/jose/jwejws/serverMultipart.xml
b/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/jose/jwejws/serverMultipart.xml
index 3cfbebc..a63fa88 100644
--- a/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/jose/jwejws/serverMultipart.xml
+++ b/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/jose/jwejws/serverMultipart.xml
@@ -53,6 +53,17 @@ under the License.
             <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-jws-multipart}/jwsjwkrsaSinglePart">
+        <jaxrs:serviceBeans>
+            <ref bean="serviceBean"/>
+        </jaxrs:serviceBeans>
+        <jaxrs:providers>
+            <ref bean="jwsInMultipartFilter"/>
+        </jaxrs:providers>
+        <jaxrs:properties>
+            <entry key="rs.security.signature.properties" value="org/apache/cxf/systest/jaxrs/security/alice.jwk.properties"/>
+        </jaxrs:properties>
+    </jaxrs:server>
     <jaxrs:server address="https://localhost:${testutil.ports.jaxrs-jws-multipart}/jwsjwkhmacSinglePartModified">
         <jaxrs:serviceBeans>
             <ref bean="serviceBean"/>


Mime
View raw message