use of org.apache.cxf.systest.jaxrs.security.jose.BookStore in project cxf by apache.
the class JAXRSJweJsonTest method testJweJsontTwoRecipientsKeyWrapAndAesGcm.
@Test
public void testJweJsontTwoRecipientsKeyWrapAndAesGcm() throws Exception {
String address = "https://localhost:" + PORT + "/jwejsonTwoRecipients";
BookStore bs = createBookStoreTwoRecipients(address);
String text = bs.echoTextJweJsonIn("book");
assertEquals("bookbook", text);
}
use of org.apache.cxf.systest.jaxrs.security.jose.BookStore in project cxf by apache.
the class JAXRSJweJwsTest method testJweRsaJwsPlainTextHMac.
@Test
public void testJweRsaJwsPlainTextHMac() throws Exception {
String address = "https://localhost:" + PORT + "/jwejwshmac";
HmacJwsSignatureProvider hmacProvider = new HmacJwsSignatureProvider(ENCODED_MAC_KEY, SignatureAlgorithm.HS256);
BookStore bs = createJweJwsBookStore(address, hmacProvider, null);
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 testJwsJwkBookHMac.
@Test
public void testJwsJwkBookHMac() throws Exception {
String address = "https://localhost:" + PORT + "/jwsjwkhmac";
BookStore bs = createJwsBookStore(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 testJwsJwkPlainTextHMacHttpHeadersModified.
@Test(expected = BadRequestException.class)
public void testJwsJwkPlainTextHMacHttpHeadersModified() throws Exception {
String address = "https://localhost:" + PORT + "/jwsjwkhmacHttpHeaders";
BookStore bs = createJwsBookStore(address, null, true, true);
WebClient.client(bs).header("Modify", "true");
bs.echoText("book");
}
use of org.apache.cxf.systest.jaxrs.security.jose.BookStore in project cxf by apache.
the class JAXRSJweJwsTest method testJwsJwkEC.
@Test
public void testJwsJwkEC() throws Exception {
String address = "https://localhost:" + PORT + "/jwsjwkec";
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/jws.ec.private.properties");
bean.getProperties(true).put("rs.security.signature.in.properties", "org/apache/cxf/systest/jaxrs/security/jws.ec.public.properties");
BookStore bs = bean.create(BookStore.class);
String text = bs.echoText("book");
assertEquals("book", text);
}
Aggregations