use of org.apache.cxf.systest.jaxrs.security.jose.BookStore in project cxf by apache.
the class JAXRSJweJwsTest method testJweRsaJwsRsaXML.
// Test signing and encrypting an XML payload
@Test
public void testJweRsaJwsRsaXML() throws Exception {
String address = "https://localhost:" + PORT + "/jwejwsrsa";
BookStore bs = createJweJwsBookStore(address, null, null);
Book book = new Book();
book.setName("book");
book = bs.echoBookXml(book);
assertEquals("book", book.getName());
}
use of org.apache.cxf.systest.jaxrs.security.jose.BookStore in project cxf by apache.
the class JAXRSJweJwsTest method doTestJwsJwkRSA.
private void doTestJwsJwkRSA(String address, boolean includePublicKey, boolean includeKeyId) throws Exception {
JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
SpringBusFactory bf = new SpringBusFactory();
URL busFile = JAXRSJweJwsTest.class.getResource("client.xml");
Bus springBus = bf.createBus(busFile.toString());
bean.setBus(springBus);
bean.setServiceClass(BookStore.class);
bean.setAddress(address);
List<Object> providers = new LinkedList<Object>();
JwsWriterInterceptor jwsWriter = new JwsWriterInterceptor();
jwsWriter.setUseJwsOutputStream(true);
providers.add(jwsWriter);
providers.add(new JwsClientResponseFilter());
bean.setProviders(providers);
bean.getProperties(true).put("rs.security.signature.out.properties", "org/apache/cxf/systest/jaxrs/security/alice.jwk.properties");
bean.getProperties(true).put("rs.security.signature.in.properties", "org/apache/cxf/systest/jaxrs/security/bob.jwk.properties");
if (includePublicKey) {
bean.getProperties(true).put("rs.security.signature.include.public.key", true);
}
if (includeKeyId) {
bean.getProperties(true).put("rs.security.signature.include.key.id", true);
}
BookStore bs = bean.create(BookStore.class);
String text = bs.echoText("book");
assertEquals("book", text);
}
use of org.apache.cxf.systest.jaxrs.security.jose.BookStore in project cxf by apache.
the class JAXRSJweJwsTest method testJweJwkBookBeanRSA.
@Test
public void testJweJwkBookBeanRSA() throws Exception {
String address = "https://localhost:" + PORT + "/jwejwkrsa";
BookStore bs = createJweBookStore(address, Collections.singletonList(new JacksonJsonProvider()));
Book book = bs.echoBook(new Book("book", 123L));
assertEquals("book", book.getName());
assertEquals(123L, book.getId());
}
use of org.apache.cxf.systest.jaxrs.security.jose.BookStore in project cxf by apache.
the class JAXRSJweJwsTest method testJweJwkAesWrap.
@Test
public void testJweJwkAesWrap() throws Exception {
String address = "https://localhost:" + PORT + "/jwejwkaeswrap";
JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
SpringBusFactory bf = new SpringBusFactory();
URL busFile = JAXRSJweJwsTest.class.getResource("client.xml");
Bus springBus = bf.createBus(busFile.toString());
bean.setBus(springBus);
bean.setServiceClass(BookStore.class);
bean.setAddress(address);
List<Object> providers = new LinkedList<Object>();
JweWriterInterceptor jweWriter = new JweWriterInterceptor();
jweWriter.setUseJweOutputStream(true);
providers.add(jweWriter);
providers.add(new JweClientResponseFilter());
bean.setProviders(providers);
bean.getProperties(true).put("rs.security.encryption.properties", "org/apache/cxf/systest/jaxrs/security/secret.jwk.properties");
bean.getProperties(true).put("jose.debug", true);
BookStore bs = bean.create(BookStore.class);
String text = bs.echoText("book");
assertEquals("book", text);
}
use of org.apache.cxf.systest.jaxrs.security.jose.BookStore in project cxf by apache.
the class JAXRSJwsJsonTest method testJwsJsonPlainTextHmac.
@Test
public void testJwsJsonPlainTextHmac() throws Exception {
String address = "https://localhost:" + PORT + "/jwsjsonhmac";
BookStore bs = createBookStore(address, "org/apache/cxf/systest/jaxrs/security/secret.jwk.properties", null);
String text = bs.echoText("book");
assertEquals("book", text);
}
Aggregations