@Test(expected = InvalidClientMetadataException.class) public void test_WrongKeyType() { ObjectNode rsaKey = Json.mapper.createObjectNode() .put("kty","wrongKeyType") .put("kid","rsaKid") .put("use","enc") .put("e","exponent") .put("n","modulus"); ArrayNode arrayNode = Json.mapper.createArrayNode().add(rsaKey); ObjectNode root = (ObjectNode) Json.mapper.createObjectNode().set("keys",arrayNode); new JWKSetDeserializer().convert(root); }
@Override public Optional<JWKSet> convert(ObjectNode node) { if (node == null) { return null; } if (node.get("keys") == null || node.get("keys").isNull() || node.get("keys").equals(new TextNode("null")) || node.get("keys").equals(new TextNode("")) ) { return Optional.empty(); } return convert(node.toString()); }
JWKSetDeserializer extends StdConverter<ObjectNode, Optional<JWKSet>> { @Override public Optional<JWKSet> convert(ObjectNode node) { if (node == null) { return null; } if (node.get("keys") == null || node.get("keys").isNull() || node.get("keys").equals(new TextNode("null")) || node.get("keys").equals(new TextNode("")) ) { return Optional.empty(); } return convert(node.toString()); } }
JWKSetDeserializer extends StdConverter<ObjectNode, Optional<JWKSet>> { @Override public Optional<JWKSet> convert(ObjectNode node) { if (node == null) { return null; } if (node.get("keys") == null || node.get("keys").isNull() || node.get("keys").equals(new TextNode("null")) || node.get("keys").equals(new TextNode("")) ) { return Optional.empty(); } return convert(node.toString()); }  }
JWKSetDeserializer extends StdConverter<ObjectNode, Optional<JWKSet>> { @Override public Optional<JWKSet> convert(ObjectNode node) { if (node == null) { return null; } if (node.get("keys") == null || node.get("keys").isNull() || node.get("keys").equals(new TextNode("null")) || node.get("keys").equals(new TextNode("")) ) { return Optional.empty(); } return convert(node.toString()); }  @Override Optional<JWKSet> convert(ObjectNode node); Optional<JWKSet> convert(String jwkSetAsString); }
JWKSetDeserializer extends StdConverter<ObjectNode, Optional<JWKSet>> { @Override public Optional<JWKSet> convert(ObjectNode node) { if (node == null) { return null; } if (node.get("keys") == null || node.get("keys").isNull() || node.get("keys").equals(new TextNode("null")) || node.get("keys").equals(new TextNode("")) ) { return Optional.empty(); } return convert(node.toString()); }  @Override Optional<JWKSet> convert(ObjectNode node); Optional<JWKSet> convert(String jwkSetAsString); final static String PARSE_ERROR_MESSAGE; }