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>
AValidator
for 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 useValidator
directly instead.Copyright © 2017 Carlos Macasaet.
- Author:
- Carlos Macasaet
-
-
Method Summary
Modifier and Type Method Description default Charset
getCharset()
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:Validator
Implement this to define how decrypted content is deserialised into domain objects.- Specified by:
getTransformer
in interfaceValidator<T>
- Returns:
- a method for converting the decrypted payload into a domain object
-
-