Package com.macasaet.fernet
Interface StringObjectValidator<T>
-
- Type Parameters:
T- The type of the payload. The Fernet token encodes the payload in binary. The type T should be a domain object or data transfer object representation of that data.
- All Superinterfaces:
Validator<T>
public interface StringObjectValidator<T> extends Validator<T>
AValidatorfor payloads that represent objects as Strings (e.g. JSON or XML). This validator converts the payload to a String then delegates togetStringTransformer()to convert that String to an object. If the deserialisation library you use already provides a way to convert binary into objects, then you can useValidatordirectly instead.Copyright © 2017 Carlos Macasaet.
- Author:
- Carlos Macasaet
-
-
Method Summary
Modifier and Type Method Description default CharsetgetCharset()default Function<byte[],String>getStringCreator()Override this to specify an alternative way to convert binary data into a String.Function<String,T>getStringTransformer()Plug in your String deserialisation method here.default Function<byte[],T>getTransformer()Implement this to define how decrypted content is deserialised into domain objects.-
Methods inherited from interface com.macasaet.fernet.Validator
getClock, getMaxClockSkew, getObjectValidator, getTimeToLive, validateAndDecrypt, validateAndDecrypt
-
-
-
-
Method Detail
-
getCharset
default Charset getCharset()
-
getStringCreator
default Function<byte[],String> getStringCreator()
Override this to specify an alternative way to convert binary data into a String. The default implementation uses the UTF-8 character set.- Returns:
- a method for converting a byte array into a String
-
getTransformer
default Function<byte[],T> getTransformer()
Description copied from interface:ValidatorImplement this to define how decrypted content is deserialised into domain objects.- Specified by:
getTransformerin interfaceValidator<T>- Returns:
- a method for converting the decrypted payload into a domain object
-
-