com.auth0.jwt.impl.HeaderDeserializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-jwt Show documentation
Show all versions of java-jwt Show documentation
Java implementation of JSON Web Token (JWT)
package com.auth0.jwt.impl;
import com.auth0.jwt.HeaderParams;
import com.auth0.jwt.exceptions.JWTDecodeException;
import com.fasterxml.jackson.core.JsonParser;
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.Map;
/**
* Jackson deserializer implementation for converting from JWT Header parts.
*
* This class is thread-safe.
*
* @see JWTParser
*/
class HeaderDeserializer extends StdDeserializer {
private final ObjectReader objectReader;
HeaderDeserializer(ObjectReader objectReader) {
this(null, objectReader);
}
private HeaderDeserializer(Class> vc, ObjectReader objectReader) {
super(vc);
this.objectReader = objectReader;
}
@Override
public BasicHeader deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
Map tree = p.getCodec().readValue(p, new TypeReference