Package nl.b3p.tailormap.api.util
Class TMPasswordDeserializer
- java.lang.Object
-
- com.fasterxml.jackson.databind.JsonDeserializer<String>
-
- nl.b3p.tailormap.api.util.TMPasswordDeserializer
-
- All Implemented Interfaces:
com.fasterxml.jackson.databind.deser.NullValueProvider
public class TMPasswordDeserializer extends com.fasterxml.jackson.databind.JsonDeserializer<String>
-
-
Constructor Summary
Constructors Constructor Description TMPasswordDeserializer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringdeserialize(@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 booleanvalidatePasswordStrength(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
-
-
-
-
Method Detail
-
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:
deserializein classcom.fasterxml.jackson.databind.JsonDeserializer<String>- Parameters:
jsonParser- parsercontext- context- Returns:
- The bcrypt hashed password
- Throws:
IOException- when JSON processing fails,InvalidPasswordExceptionwhen the password is not strong enough
-
validatePasswordStrength
public static boolean validatePasswordStrength(String password, int minLength, int minStrength)
-
-