Class SecretsJwtTokenHandler
- java.lang.Object
-
- org.forgerock.json.jose.tokenhandler.SecretsJwtTokenHandler
-
- All Implemented Interfaces:
TokenHandler
public final class SecretsJwtTokenHandler extends Object implements TokenHandler
Token handler for creating tokens using a JWT as the store.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSecretsJwtTokenHandler.BuilderBuilder pattern object for configuring aSecretsJwtTokenHandler.
-
Constructor Summary
Constructors Constructor Description SecretsJwtTokenHandler(JweAlgorithm jweAlgorithm, EncryptionMethod jweMethod, JwsAlgorithm jwsAlgorithm, Optional<Long> tokenLifeTimeInSeconds, KeyPair jweKeyPair, SigningManager manager, Purpose<SigningKey> signingKeyPurpose, Purpose<VerificationKey> verificationKeyPurpose, Clock clock)Deprecated.Usebuilder()instead.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SecretsJwtTokenHandler.Builderbuilder()Creates a newSecretsJwtTokenHandler.Builderobject to configure aSecretsJwtTokenHandlerinstance.Stringgenerate(JsonValue state)Generates a new token using the state.voidvalidate(String snapshotToken)Validates the passed token.JsonValuevalidateAndExtractState(String snapshotToken)Validates and parses the token, extracting any encapsulated state.
-
-
-
Constructor Detail
-
SecretsJwtTokenHandler
@Deprecated public SecretsJwtTokenHandler(JweAlgorithm jweAlgorithm, EncryptionMethod jweMethod, JwsAlgorithm jwsAlgorithm, Optional<Long> tokenLifeTimeInSeconds, KeyPair jweKeyPair, SigningManager manager, Purpose<SigningKey> signingKeyPurpose, Purpose<VerificationKey> verificationKeyPurpose, Clock clock)
Deprecated.Usebuilder()instead.Constructs a new JWT token handler.- Parameters:
jweAlgorithm- the JWE algorithm use to construct the key pairjweMethod- the encryption method to usejwsAlgorithm- the JWS algorithm to usetokenLifeTimeInSeconds- token life time in secondsjweKeyPair- key pair for the purpose of encryptionmanager- manager used to obtain secretssigningKeyPurpose- purpose of the signing secretverificationKeyPurpose- purpose of the signature verification secretclock- clock to handle expiration timeouts
-
-
Method Detail
-
builder
public static SecretsJwtTokenHandler.Builder builder()
Creates a newSecretsJwtTokenHandler.Builderobject to configure aSecretsJwtTokenHandlerinstance.- Returns:
- a fresh builder instance.
-
generate
public String generate(JsonValue state) throws TokenHandlerException
Description copied from interface:TokenHandlerGenerates a new token using the state.- Specified by:
generatein interfaceTokenHandler- Parameters:
state- the state- Returns:
- token
- Throws:
TokenHandlerException- on failure to generate token
-
validate
public void validate(String snapshotToken) throws TokenHandlerException
Description copied from interface:TokenHandlerValidates the passed token.- Specified by:
validatein interfaceTokenHandler- Parameters:
snapshotToken- the token to be validated- Throws:
InvalidTokenException- on invalid tokenExpiredTokenException- on expired tokenTokenHandlerException- on other failure to validate token
-
validateAndExtractState
public JsonValue validateAndExtractState(String snapshotToken) throws TokenHandlerException
Description copied from interface:TokenHandlerValidates and parses the token, extracting any encapsulated state.- Specified by:
validateAndExtractStatein interfaceTokenHandler- Parameters:
snapshotToken- the token to be validated and parsed- Returns:
- the state
- Throws:
InvalidTokenException- on invalid tokenExpiredTokenException- on expired tokenTokenHandlerException- on other failure to validate or extract token
-
-