com.auth0.jwt.impl.PayloadDeserializer Maven / Gradle / Ivy
package com.auth0.jwt.impl;
import com.auth0.jwt.exceptions.JWTDecodeException;
import com.auth0.jwt.interfaces.Payload;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectReader;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import java.io.IOException;
import java.util.*;
class PayloadDeserializer extends StdDeserializer {
private final ObjectReader objectReader;
PayloadDeserializer(ObjectReader reader) {
this(null, reader);
}
private PayloadDeserializer(Class vc, ObjectReader reader) {
super(vc);
this.objectReader = reader;
}
@Override
public Payload deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
Map tree = p.getCodec().readValue(p, new TypeReference