public class TokenManager extends Object
Manages the caching of tokens
| Modifier and Type | Method and Description |
|---|---|
void |
clearTokenCache()
Removes all tokens from the cache
|
static TokenManager |
instance() |
Token |
retrieveTokenWithExactScope(String username,
AuthorisationScope... requiredScopes)
Retrieve a cached token which has exactly the given set
of scopes
|
Token |
retrieveTokenWithExactScope(String username,
List<AuthorisationScope> scopes)
Retrieve a cached token which has exactly the given set
of scopes
|
Token |
retrieveTokenWithScope(String username,
AuthorisationScope... scopes)
Retrieve a token which has at least the given set of
scopes.
|
Token |
retrieveTokenWithScope(String username,
List<AuthorisationScope> scopes)
Retrieve a token which has at least the given set of
scopes.
|
void |
revokeToken(Token token)
Revoke an access token - that is, remove it from the cache of tokens.
|
void |
storeToken(Token token)
Place a token in the cache
|
public static TokenManager instance()
public void clearTokenCache()
Removes all tokens from the cache
public Token retrieveTokenWithExactScope(String username, AuthorisationScope... requiredScopes)
Retrieve a cached token which has exactly the given set of scopes
username - The usernamerequiredScopes - This list of scopes which must match the scopes of the tokennull
if there is no such tokenpublic Token retrieveTokenWithExactScope(String username, List<AuthorisationScope> scopes)
Retrieve a cached token which has exactly the given set of scopes
username - The user to look up for a cached tokenscopes - The set of scopes the token must havenull if there is no matching tokenpublic Token retrieveTokenWithScope(String username, AuthorisationScope... scopes)
Retrieve a token which has at least the given set of scopes.
username - The usernamescopes - The list of scopes which are required to be in the tokennull if there is no cached token, or
the cached token doesn't have all the required scopespublic Token retrieveTokenWithScope(String username, List<AuthorisationScope> scopes)
Retrieve a token which has at least the given set of scopes.
username - The usernamescopes - The list of scopes which are required to be in the tokennull if there is no cached token, or
the cached token doesn't have all the required scopespublic void revokeToken(Token token)
Revoke an access token - that is, remove it from the cache of tokens.
token - The token to be removed from the cachepublic void storeToken(Token token)
Place a token in the cache
token - The token to be stored in the cache.IllegalArgumentException - If the token is null, or the athlete contained in it is null or has a null email, or there are no authorisation scopes, thenCopyright © 2016 Dan Shannon. All rights reserved.