Interface TokenProvider
-
- All Known Implementing Classes:
CompositeTokenProvider
public interface TokenProviderInterface to manage create and manage login tokens.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringPARAM_TOKEN_EXPIRATIONOptional configuration parameter to set the token expiration time in ms.static java.lang.StringPARAM_TOKEN_LENGTHOptional configuration parameter to define the length of the key.static java.lang.StringPARAM_TOKEN_REFRESHOptional configuration parameter to define if a given token should be refreshed or not.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @Nullable TokenInfocreateToken(@NotNull java.lang.String userId, @NotNull java.util.Map<java.lang.String,?> attributes)Issues a new login token for the user with the givenuserIdand the specified attributes.@Nullable TokenInfocreateToken(@NotNull javax.jcr.Credentials credentials)Issues a new login token for the user with the specified credentials and returns the associatedTokenInfo.booleandoCreateToken(@NotNull javax.jcr.Credentials credentials)Returnstrueif the given credentials indicate that a new token needs to be issued.@Nullable TokenInfogetTokenInfo(@NotNull java.lang.String token)Retrieves theTokenInfoassociated with the specified login token ornull.
-
-
-
Field Detail
-
PARAM_TOKEN_EXPIRATION
static final java.lang.String PARAM_TOKEN_EXPIRATION
Optional configuration parameter to set the token expiration time in ms. Implementations that do not support this option will ignore any config options with that name.- See Also:
- Constant Field Values
-
PARAM_TOKEN_LENGTH
static final java.lang.String PARAM_TOKEN_LENGTH
Optional configuration parameter to define the length of the key. Implementations that do not support this option will ignore any config options with that name.- See Also:
- Constant Field Values
-
PARAM_TOKEN_REFRESH
static final java.lang.String PARAM_TOKEN_REFRESH
Optional configuration parameter to define if a given token should be refreshed or not. Implementations that do not support this option will ignore any config options with that name.- See Also:
- Constant Field Values
-
-
Method Detail
-
doCreateToken
boolean doCreateToken(@NotNull @NotNull javax.jcr.Credentials credentials)Returnstrueif the given credentials indicate that a new token needs to be issued.- Parameters:
credentials- The current credentials.- Returns:
trueif a new login token needs to be created,falseotherwise.
-
createToken
@Nullable @Nullable TokenInfo createToken(@NotNull @NotNull javax.jcr.Credentials credentials)
Issues a new login token for the user with the specified credentials and returns the associatedTokenInfo.- Parameters:
credentials- The current credentials.- Returns:
- The
TokenInfoassociated with the new login token ornullif no token has been created.
-
createToken
@Nullable @Nullable TokenInfo createToken(@NotNull @NotNull java.lang.String userId, @NotNull @NotNull java.util.Map<java.lang.String,?> attributes)
Issues a new login token for the user with the givenuserIdand the specified attributes.- Parameters:
userId- The identifier of the user for which a new token should be created.attributes- The attributes associated with the new token.- Returns:
- The
TokenInfoassociated with the new login token ornullif no token has been created.
-
getTokenInfo
@Nullable @Nullable TokenInfo getTokenInfo(@NotNull @NotNull java.lang.String token)
Retrieves theTokenInfoassociated with the specified login token ornull.- Parameters:
token- A valid login token.- Returns:
- the
TokenInfoassociated with the specified login token ornull.
-
-