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.public interface Validator<T>
Copyright © 2017 Carlos Macasaet.
StringObjectValidator
,
StringValidator
Modifier and Type | Method and Description |
---|---|
default Clock |
getClock()
Override this method if your application uses a custom clock.
|
default TemporalAmount |
getMaxClockSkew()
Override this method to define a custom acceptable clock skew.
|
default Predicate<T> |
getObjectValidator()
Implement this to define application-specific security rules.
|
default TemporalAmount |
getTimeToLive()
Override this method to define the maximum allowable age of a token.
|
Function<byte[],T> |
getTransformer()
Implement this to define how decrypted content is deserialised into domain objects.
|
default T |
validateAndDecrypt(Collection<? extends Key> keys,
Token token)
Check the validity of a token against a pool of keys.
|
default T |
validateAndDecrypt(Key key,
Token token)
Check the validity of the token then decrypt and deserialise the payload.
|
default Clock getClock()
default TemporalAmount getTimeToLive()
Predicate
defined by getObjectValidator()
applies
varying TTL checks depending on the payload (e.g. progressively shorter TTLs), then the TTL specified here must
be at least as long as any defined in the Predicate.default TemporalAmount getMaxClockSkew()
default Predicate<T> getObjectValidator()
Function<byte[],T> getTransformer()
default T validateAndDecrypt(Key key, Token token) throws TokenValidationException
key
- the stored shared secret keytoken
- the client-provided token of unknown validityTokenValidationException
- if the token is invalid.default T validateAndDecrypt(Collection<? extends Key> keys, Token token) throws TokenValidationException
ForkJoinPool
.keys
- all the non-expired keys that could have been used to generate a tokentoken
- the client-provided token of unknown validityTokenValidationException
- if the token was not generated using any of the supplied keys.Copyright © 2017. All rights reserved.