Package net.officefloor.web.jwt.validate
Class JwtValidateKey
java.lang.Object
net.officefloor.web.jwt.validate.JwtValidateKey
- All Implemented Interfaces:
Serializable
JWT validate key.
- Author:
- Daniel Sagenschneider
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionJwtValidateKey(long startTime, long expireTime, Key key) Instantiate.JwtValidateKey(Key key) Instantiates to (effectively) never expire.JwtValidateKey(Clock<Long> timeInSeconds, long periodToExpire, TimeUnit unit, Key key) Instantiate to become active immediately and expire within the specified time. -
Method Summary
Modifier and TypeMethodDescriptionlongObtains the milliseconds since Epoch for expiry of thisJwtValidateKey.getKey()Obtains theKey.longObtains the milliseconds since Epoch for when thisJwtValidateKeybecomes active.
-
Constructor Details
-
JwtValidateKey
Instantiate.- Parameters:
startTime- Seconds since Epoch for when thisJwtValidateKeybecomes active.expireTime- Seconds since Epoch for expiry of thisJwtValidateKey.key-Keyto validate the JWT.- Throws:
IllegalArgumentException- If invalid arguments.
-
JwtValidateKey
public JwtValidateKey(Clock<Long> timeInSeconds, long periodToExpire, TimeUnit unit, Key key) throws IllegalArgumentException Instantiate to become active immediately and expire within the specified time.- Parameters:
timeInSeconds-Clockto obtain the seconds since Epoch.periodToExpire- Period to expire theKey.unit-TimeUnitfor period.key-Keyto validate the JWT.- Throws:
IllegalArgumentException- If invalid arguments.
-
JwtValidateKey
Instantiates to (effectively) never expire.
This should only be used for testing. Within production environments,
Keyinstances should be rotated at a semi-regular basis to reduce impact of compromised keys.- Parameters:
key-Key.- Throws:
IllegalArgumentException- If missingKey.
-
-
Method Details
-
getStartTime
public long getStartTime()Obtains the milliseconds since Epoch for when thisJwtValidateKeybecomes active.- Returns:
- Milliseconds since Epoch for when this
JwtValidateKeybecomes active.
-
getExpireTime
public long getExpireTime()Obtains the milliseconds since Epoch for expiry of thisJwtValidateKey.- Returns:
- Milliseconds since Epoch for expiry of this
JwtValidateKey.
-
getKey
Obtains theKey.- Returns:
Keyto validate the JWT.
-