@Test
public void testReadJwsWithJwkSignedByMac() throws Exception {
JwsJwtCompactConsumer jws = new JwsJwtCompactConsumer(ENCODED_TOKEN_WITH_JSON_KEY_SIGNED_BY_MAC);
assertTrue(jws.verifySignatureWith(new HmacJwsSignatureProvider(ENCODED_MAC_KEY)));
JwtToken token = jws.getJwtToken();
JwtHeaders headers = token.getHeaders();
assertEquals(JwtConstants.TYPE_JWT, headers.getType());
assertEquals(Algorithm.HmacSHA256.getJwtName(), headers.getAlgorithm());
JsonWebKey key = headers.getJsonWebKey();
assertEquals(JsonWebKey.KEY_TYPE_OCTET, key.getKeyType());
List<String> keyOps = key.getKeyOperation();
assertEquals(2, keyOps.size());
assertEquals(JsonWebKey.KEY_OPER_SIGN, keyOps.get(0));
assertEquals(JsonWebKey.KEY_OPER_VERIFY, keyOps.get(1));
validateSpecClaim(token.getClaims());
}