Interface Token
-
- All Known Implementing Classes:
DefaultToken
public interface Token
A token issued byTokenService
.It is important that the keys assigned to tokens are sufficiently randomised and secured that they can serve as identifying a unique user session. Implementations of
TokenService
are free to use encryption or encoding strategies of their choice. It is strongly recommended that keys are of sufficient length to balance safety against persistence cost. In relation to persistence cost, it is strongly recommended that returned keys are small enough for encoding in a cookie.- Since:
- 2.0.1
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.String
getExtendedInformation()
Obtains the extended information associated within the token, which was presented when the token was first created.java.lang.String
getKey()
Obtains the randomised, secure key assigned to this token.long
getKeyCreationTime()
The time the token key was initially created is available from this method.
-
-
-
Method Detail
-
getKey
java.lang.String getKey()
Obtains the randomised, secure key assigned to this token. Presentation of this token toTokenService
will always return aToken
that is equal to the originalToken
issued for that key.- Returns:
- a key with appropriate randomness and security.
-
getKeyCreationTime
long getKeyCreationTime()
The time the token key was initially created is available from this method. Note that a given token must never have this creation time changed. If necessary, a new token can be requested from theTokenService
to replace the original token.- Returns:
- the time this token key was created, in the same format as specified by
Date.getTime()
.
-
getExtendedInformation
java.lang.String getExtendedInformation()
Obtains the extended information associated within the token, which was presented when the token was first created.- Returns:
- the user-specified extended information, if any
-
-