public class InMemoryTokenStore extends Object implements TokenStore
| Constructor and Description |
|---|
InMemoryTokenStore() |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Convenience method for super admin users to remove all tokens (useful for testing, not really in production)
|
Collection<OAuth2AccessToken> |
findTokensByClientId(String clientId) |
Collection<OAuth2AccessToken> |
findTokensByClientIdAndUserName(String clientId,
String userName) |
OAuth2AccessToken |
getAccessToken(OAuth2Authentication authentication)
Retrieve an access token stored against the provided authentication key, if it exists.
|
int |
getAccessTokenCount() |
int |
getExpiryTokenCount() |
int |
getFlushInterval()
The interval (count of token inserts) between flushing expired tokens.
|
int |
getRefreshTokenCount() |
OAuth2AccessToken |
readAccessToken(String tokenValue)
Read an access token from the store.
|
OAuth2Authentication |
readAuthentication(OAuth2AccessToken token)
Read the authentication stored under the specified token value.
|
OAuth2Authentication |
readAuthentication(String token)
Read the authentication stored under the specified token value.
|
OAuth2Authentication |
readAuthenticationForRefreshToken(OAuth2RefreshToken token) |
OAuth2Authentication |
readAuthenticationForRefreshToken(String token) |
OAuth2RefreshToken |
readRefreshToken(String tokenValue)
Read a refresh token from the store.
|
void |
removeAccessToken(OAuth2AccessToken accessToken)
Remove an access token from the database.
|
void |
removeAccessToken(String tokenValue) |
void |
removeAccessTokenUsingRefreshToken(OAuth2RefreshToken refreshToken)
Remove an access token using a refresh token.
|
void |
removeRefreshToken(OAuth2RefreshToken refreshToken)
Remove a refresh token from the database.
|
void |
removeRefreshToken(String tokenValue) |
void |
setAuthenticationKeyGenerator(AuthenticationKeyGenerator authenticationKeyGenerator) |
void |
setFlushInterval(int flushInterval)
The number of tokens to store before flushing expired tokens.
|
void |
storeAccessToken(OAuth2AccessToken token,
OAuth2Authentication authentication)
Store an access token.
|
void |
storeRefreshToken(OAuth2RefreshToken refreshToken,
OAuth2Authentication authentication)
Store the specified refresh token in the database.
|
public void setFlushInterval(int flushInterval)
flushInterval - the interval to setpublic int getFlushInterval()
public void clear()
public void setAuthenticationKeyGenerator(AuthenticationKeyGenerator authenticationKeyGenerator)
public int getAccessTokenCount()
public int getRefreshTokenCount()
public int getExpiryTokenCount()
public OAuth2AccessToken getAccessToken(OAuth2Authentication authentication)
TokenStoregetAccessToken in interface TokenStoreauthentication - the authentication key for the access tokenpublic OAuth2Authentication readAuthentication(OAuth2AccessToken token)
TokenStorereadAuthentication in interface TokenStoretoken - The token value under which the authentication is stored.public OAuth2Authentication readAuthentication(String token)
TokenStorereadAuthentication in interface TokenStoretoken - The token value under which the authentication is stored.public OAuth2Authentication readAuthenticationForRefreshToken(OAuth2RefreshToken token)
readAuthenticationForRefreshToken in interface TokenStoretoken - a refresh tokenpublic OAuth2Authentication readAuthenticationForRefreshToken(String token)
public void storeAccessToken(OAuth2AccessToken token, OAuth2Authentication authentication)
TokenStorestoreAccessToken in interface TokenStoretoken - The token to store.authentication - The authentication associated with the token.public void removeAccessToken(OAuth2AccessToken accessToken)
TokenStoreremoveAccessToken in interface TokenStoreaccessToken - The token to remove from the database.public OAuth2AccessToken readAccessToken(String tokenValue)
TokenStorereadAccessToken in interface TokenStoretokenValue - The token value.public void removeAccessToken(String tokenValue)
public void storeRefreshToken(OAuth2RefreshToken refreshToken, OAuth2Authentication authentication)
TokenStorestoreRefreshToken in interface TokenStorerefreshToken - The refresh token to store.authentication - The authentication associated with the refresh token.public OAuth2RefreshToken readRefreshToken(String tokenValue)
TokenStorereadRefreshToken in interface TokenStoretokenValue - The value of the token to read.public void removeRefreshToken(OAuth2RefreshToken refreshToken)
TokenStoreremoveRefreshToken in interface TokenStorerefreshToken - The token to remove from the database.public void removeRefreshToken(String tokenValue)
public void removeAccessTokenUsingRefreshToken(OAuth2RefreshToken refreshToken)
TokenStoreremoveAccessTokenUsingRefreshToken in interface TokenStorerefreshToken - The refresh token.public Collection<OAuth2AccessToken> findTokensByClientIdAndUserName(String clientId, String userName)
findTokensByClientIdAndUserName in interface TokenStoreclientId - the client id to searchuserName - the user name to searchpublic Collection<OAuth2AccessToken> findTokensByClientId(String clientId)
findTokensByClientId in interface TokenStoreclientId - the client id to searchCopyright © 2016. All rights reserved.