Class TMPasswordDeserializer

java.lang.Object
com.fasterxml.jackson.databind.JsonDeserializer<String>
org.tailormap.api.util.TMPasswordDeserializer
All Implemented Interfaces:
com.fasterxml.jackson.databind.deser.NullValueProvider

public class TMPasswordDeserializer extends com.fasterxml.jackson.databind.JsonDeserializer<String>
  • 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(@NotNull com.fasterxml.jackson.core.JsonParser jsonParser, com.fasterxml.jackson.databind.DeserializationContext context)
    When deserializing a JSON field containing a plaintext password validate it is strong enough and hash it with the default PasswordEncoder (bcrypt).
    static boolean
    validatePasswordStrength(String password, int minLength, int minStrength)
     

    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

    • TMPasswordDeserializer

      public TMPasswordDeserializer()
  • Method Details

    • deserialize

      public String deserialize(@NotNull @NotNull com.fasterxml.jackson.core.JsonParser jsonParser, com.fasterxml.jackson.databind.DeserializationContext context) throws IOException
      When deserializing a JSON field containing a plaintext password validate it is strong enough and hash it with the default PasswordEncoder (bcrypt).
      Specified by:
      deserialize in class com.fasterxml.jackson.databind.JsonDeserializer<String>
      Parameters:
      jsonParser - parser
      context - context
      Returns:
      The bcrypt hashed password
      Throws:
      IOException - when JSON processing fails, InvalidPasswordException when the password is not strong enough
    • validatePasswordStrength

      public static boolean validatePasswordStrength(String password, int minLength, int minStrength)