More tests
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/247dbcbf Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/247dbcbf Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/247dbcbf Branch: refs/heads/master Commit: 247dbcbfad439ef3071ee778ac5da1979750136f Parents: 8b52ca5 Author: Colm O hEigeartaigh <[email protected]> Authored: Fri Oct 16 11:56:15 2015 +0100 Committer: Colm O hEigeartaigh <[email protected]> Committed: Fri Oct 16 14:34:01 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/247dbcbf/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/247dbcbf/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>
