Class HerodotusUserDeserializer

java.lang.Object
com.fasterxml.jackson.databind.JsonDeserializer<HerodotusUser>
cn.herodotus.engine.oauth2.core.jackson2.HerodotusUserDeserializer
All Implemented Interfaces:
com.fasterxml.jackson.databind.deser.NullValueProvider

public class HerodotusUserDeserializer extends com.fasterxml.jackson.databind.JsonDeserializer<HerodotusUser>

Description: 自定义 UserDetails 序列化

Author:
: gengwei.zheng
Date:
: 2022/2/17 21:01
  • Nested Class Summary

    Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.JsonDeserializer

    com.fasterxml.jackson.databind.JsonDeserializer.None
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    deserialize(com.fasterxml.jackson.core.JsonParser jp, com.fasterxml.jackson.databind.DeserializationContext ctxt)
    This method will create User object.

    Methods inherited from class com.fasterxml.jackson.databind.JsonDeserializer

    deserialize, deserializeWithType, deserializeWithType, findBackReference, getAbsentValue, getDelegatee, getEmptyAccessPattern, getEmptyValue, getEmptyValue, getKnownPropertyNames, getNullAccessPattern, getNullValue, getNullValue, getObjectIdReader, handledType, isCachable, logicalType, replaceDelegatee, supportsUpdate, unwrappingDeserializer

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • HerodotusUserDeserializer

      public HerodotusUserDeserializer()
  • Method Details

    • deserialize

      public HerodotusUser deserialize(com.fasterxml.jackson.core.JsonParser jp, com.fasterxml.jackson.databind.DeserializationContext ctxt) throws IOException, com.fasterxml.jackson.core.JsonProcessingException
      This method will create User object. It will ensure successful object creation even if password key is null in serialized json, because credentials may be removed from the User by invoking User.eraseCredentials(). In that case there won't be any password key in serialized json.
      Specified by:
      deserialize in class com.fasterxml.jackson.databind.JsonDeserializer<HerodotusUser>
      Parameters:
      jp - the JsonParser
      ctxt - the DeserializationContext
      Returns:
      the user
      Throws:
      IOException - if a exception during IO occurs
      com.fasterxml.jackson.core.JsonProcessingException - if an error during JSON processing occurs