Package org.forgerock.tokenhandler
Interface TokenHandler
-
- All Known Implementing Classes:
JwtTokenHandler
,SecretsJwtTokenHandler
public interface TokenHandler
Responsible for the validation, generation and parsing of tokens used for keying a JsonValue representative of some state. Implementers must catch implementation-specific exceptions and re-throw asTokenHandlerException
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description String
generate(JsonValue state)
Generates a new token using the state.void
validate(String token)
Validates the passed token.JsonValue
validateAndExtractState(String token)
Validates and parses the token, extracting any encapsulated state.
-
-
-
Method Detail
-
generate
String generate(JsonValue state) throws TokenHandlerException
Generates a new token using the state.- Parameters:
state
- the state- Returns:
- token
- Throws:
TokenHandlerException
- on failure to generate token
-
validate
void validate(String token) throws TokenHandlerException
Validates the passed token.- Parameters:
token
- the token to be validated- Throws:
InvalidTokenException
- on invalid tokenExpiredTokenException
- on expired tokenTokenHandlerException
- on other failure to validate token
-
validateAndExtractState
JsonValue validateAndExtractState(String token) throws TokenHandlerException
Validates and parses the token, extracting any encapsulated state.- Parameters:
token
- 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
-
-