cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [2/4] cxf git commit: More tests
Date Fri, 16 Oct 2015 13:38:01 GMT
More tests


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

Branch: refs/heads/3.0.x-fixes
Commit: 1beb90a6b0e4c8cb4e849f5e6db3605624388dfe
Parents: 0f323e4
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Fri Oct 16 11:56:15 2015 +0100
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Fri Oct 16 14:37:48 2015 +0100

----------------------------------------------------------------------
 .../jaxrs/security/jwt/JweJwsAlgorithmTest.java | 34 ++++++++++++++++++--
 .../jaxrs/security/jwt/algorithms-server.xml    | 16 +++++++++
 2 files changed, 47 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/1beb90a6/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
index 4e617cf..4afcefa 100644
--- 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
@@ -28,6 +28,8 @@ 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;
@@ -37,8 +39,6 @@ import org.bouncycastle.jce.provider.BouncyCastleProvider;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 
-import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
-
 /**
  * Some encryption or signature tests, focus on algorithms.
  */
@@ -65,7 +65,6 @@ public class JweJwsAlgorithmTest extends AbstractBusClientServerTestBase
{
     //
     // Encryption tests
     //
-    
     @org.junit.Test
     public void testEncryptionProperties() throws Exception {
 
@@ -315,5 +314,34 @@ public class JweJwsAlgorithmTest extends AbstractBusClientServerTestBase
{
         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);
+    }
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/1beb90a6/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
index c141a40..39dfbac 100644
--- 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
@@ -57,4 +57,20 @@ under the License.
        </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>
+   
 </beans>


Mime
View raw message