com.auth0.jwt.impl.PayloadDeserializer Maven / Gradle / Ivy
package com.auth0.jwt.impl;
import com.auth0.jwt.RegisteredClaims;
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.time.Instant;
import java.util.*;
/**
* Jackson deserializer implementation for converting from JWT Payload parts.
*
* This class is thread-safe.
*
* @see JWTParser
*/
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