Skip to content

Commit

Permalink
EPA-158: Improve coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasrichner-oviva committed Oct 18, 2024
1 parent de1e3b0 commit c0ffeef
Showing 1 changed file with 0 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.oviva.ehealthid.util;

import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.TreeNode;
import com.fasterxml.jackson.core.type.TypeReference;
Expand All @@ -9,9 +8,7 @@
import com.nimbusds.jose.jwk.JWK;
import com.oviva.ehealthid.fedclient.api.ExtendedJWKSet;
import java.io.IOException;
import java.text.ParseException;
import java.util.List;
import java.util.Map;

public class ExtendedJWKSetDeserializer extends StdDeserializer<ExtendedJWKSet> {

Expand Down Expand Up @@ -52,24 +49,4 @@ private long parseLongField(JsonParser jsonParser, TreeNode node, String fieldNa
.getCodec()
.readValue(node.get(fieldName).traverse(jsonParser.getCodec()), Long.class);
}

public static class JWKDeserializer extends StdDeserializer<JWK> {

public JWKDeserializer(Class<?> vc) {
super(vc);
}

@Override
public JWK deserialize(JsonParser jsonParser, DeserializationContext deserializationContext)
throws IOException {

Map<String, Object> map =
jsonParser.getCodec().readValue(jsonParser, new TypeReference<Map<String, Object>>() {});
try {
return JWK.parse(map);
} catch (ParseException e) {
throw new JsonParseException(jsonParser, "failed to parse JWK", e);
}
}
}
}

0 comments on commit c0ffeef

Please sign in to comment.