Search in sources :

Example 1 with HmacJwsSignatureProvider

use of org.apache.cxf.rs.security.jose.jws.HmacJwsSignatureProvider 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);
}
Also used : BookStore(org.apache.cxf.systest.jaxrs.security.jose.BookStore) HmacJwsSignatureProvider(org.apache.cxf.rs.security.jose.jws.HmacJwsSignatureProvider) Test(org.junit.Test)

Example 2 with HmacJwsSignatureProvider

use of org.apache.cxf.rs.security.jose.jws.HmacJwsSignatureProvider in project cxf by apache.

the class JAXRSJweJwsTest method testJweRsaJwsBookHMac.

@Test
public void testJweRsaJwsBookHMac() throws Exception {
    String address = "https://localhost:" + PORT + "/jwejwshmac";
    HmacJwsSignatureProvider hmacProvider = new HmacJwsSignatureProvider(ENCODED_MAC_KEY, SignatureAlgorithm.HS256);
    BookStore bs = createJweJwsBookStore(address, hmacProvider, Collections.singletonList(new JacksonJsonProvider()));
    Book book = bs.echoBook(new Book("book", 123L));
    assertEquals("book", book.getName());
    assertEquals(123L, book.getId());
}
Also used : BookStore(org.apache.cxf.systest.jaxrs.security.jose.BookStore) Book(org.apache.cxf.systest.jaxrs.security.Book) HmacJwsSignatureProvider(org.apache.cxf.rs.security.jose.jws.HmacJwsSignatureProvider) JacksonJsonProvider(com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider) Test(org.junit.Test)

Aggregations

HmacJwsSignatureProvider (org.apache.cxf.rs.security.jose.jws.HmacJwsSignatureProvider)2 BookStore (org.apache.cxf.systest.jaxrs.security.jose.BookStore)2 Test (org.junit.Test)2 JacksonJsonProvider (com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider)1 Book (org.apache.cxf.systest.jaxrs.security.Book)1