use of org.apache.cxf.systest.jaxrs.security.Book in project cxf by apache.
the class JAXRSJwsJsonTest method testJwsJsonBookDoubleHmacManyProps.
@Test
public void testJwsJsonBookDoubleHmacManyProps() throws Exception {
String address = "https://localhost:" + PORT + "/jwsjsonhmac2";
List<String> properties = new ArrayList<>();
properties.add("org/apache/cxf/systest/jaxrs/security/secret.jwk.properties");
properties.add("org/apache/cxf/systest/jaxrs/security/secret.jwk.hmac.properties");
Map<String, Object> map = new HashMap<>();
map.put(JoseConstants.RSSEC_SIGNATURE_OUT_PROPS, properties);
map.put(JoseConstants.RSSEC_SIGNATURE_IN_PROPS, "org/apache/cxf/systest/jaxrs/security/secret.jwk.hmac.properties");
BookStore bs = createBookStore(address, map, null);
Book book = bs.echoBook(new Book("book", 123L));
assertEquals("book", book.getName());
assertEquals(123L, book.getId());
}
use of org.apache.cxf.systest.jaxrs.security.Book in project cxf by apache.
the class JAXRSJwsMultipartTest method testJwsJwkBookHMacMultipartModified.
@Test(expected = BadRequestException.class)
public void testJwsJwkBookHMacMultipartModified() throws Exception {
String address = "https://localhost:" + PORT + "/jwsjwkhmacModified";
BookStore bs = createJwsBookStoreHMac(address, false, false);
bs.echoBookMultipartModified(new Book("book", 123L));
}
use of org.apache.cxf.systest.jaxrs.security.Book in project cxf by apache.
the class JAXRSJwsMultipartTest method testJwsJwkBooksHMacMultipart.
@Test
public void testJwsJwkBooksHMacMultipart() throws Exception {
String address = "https://localhost:" + PORT + "/jwsjwkhmac";
BookStore bs = createJwsBookStoreHMac(address, false, false);
List<Book> books = new LinkedList<Book>();
books.add(new Book("book", 123L));
books.add(new Book("book2", 124L));
List<Book> returnBooks = bs.echoBooksMultipart(books);
assertEquals("book", returnBooks.get(0).getName());
assertEquals(123L, returnBooks.get(0).getId());
assertEquals("book2", returnBooks.get(1).getName());
assertEquals(124L, returnBooks.get(1).getId());
}
use of org.apache.cxf.systest.jaxrs.security.Book in project cxf by apache.
the class JAXRSJwsMultipartTest method testJwsJwkBookHMacMultipartJwsJson.
@Test
public void testJwsJwkBookHMacMultipartJwsJson() throws Exception {
String address = "https://localhost:" + PORT + "/jwsjwkhmacJwsJson";
BookStore bs = createJwsBookStoreHMac(address, false, true);
Book book = bs.echoBookMultipart(new Book("book", 123L));
assertEquals("book", book.getName());
assertEquals(123L, book.getId());
}
use of org.apache.cxf.systest.jaxrs.security.Book in project cxf by apache.
the class JweJwsAlgorithmTest method testBadEncryptingKey.
@org.junit.Test
public void testBadEncryptingKey() throws Exception {
URL busFile = JweJwsAlgorithmTest.class.getResource("client.xml");
List<Object> providers = new ArrayList<>();
providers.add(new JacksonJsonProvider());
providers.add(new JweWriterInterceptor());
String address = "http://localhost:" + PORT + "/jweoaepgcm/bookstore/books";
WebClient client = WebClient.create(address, providers, busFile.toString());
client.type("application/json").accept("application/json");
Map<String, Object> properties = new HashMap<>();
properties.put("rs.security.keystore.type", "jwk");
properties.put("rs.security.keystore.alias", "AliceCert");
properties.put("rs.security.keystore.file", "org/apache/cxf/systest/jaxrs/security/certs/jwkPublicSet.txt");
properties.put("rs.security.encryption.content.algorithm", "A128GCM");
properties.put("rs.security.encryption.key.algorithm", "RSA-OAEP");
WebClient.getConfig(client).getRequestContext().putAll(properties);
Response response = client.post(new Book("book", 123L));
assertNotEquals(response.getStatus(), 200);
}
Aggregations