Package org.tailormap.api.util
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
-
Nested Class Summary
Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.JsonDeserializer
com.fasterxml.jackson.databind.JsonDeserializer.None
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondeserialize
(@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
-
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 classcom.fasterxml.jackson.databind.JsonDeserializer<String>
- Parameters:
jsonParser
- parsercontext
- context- Returns:
- The bcrypt hashed password
- Throws:
IOException
- when JSON processing fails,InvalidPasswordException
when the password is not strong enough
-
validatePasswordStrength
-