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 class
SecretsJwtTokenHandler.Builder
Builder 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.Builder
builder()
Creates a newSecretsJwtTokenHandler.Builder
object to configure aSecretsJwtTokenHandler
instance.String
generate(JsonValue state)
Generates a new token using the state.void
validate(String snapshotToken)
Validates the passed token.JsonValue
validateAndExtractState(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.Builder
object to configure aSecretsJwtTokenHandler
instance.- Returns:
- a fresh builder instance.
-
generate
public String generate(JsonValue state) throws TokenHandlerException
Description copied from interface:TokenHandler
Generates a new token using the state.- Specified by:
generate
in 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:TokenHandler
Validates the passed token.- Specified by:
validate
in 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:TokenHandler
Validates and parses the token, extracting any encapsulated state.- Specified by:
validateAndExtractState
in 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
-
-