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 store.
|
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 store.
|
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 store.
|
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)
TokenStore
getAccessToken
in interface TokenStore
authentication
- the authentication key for the access tokenpublic OAuth2Authentication readAuthentication(OAuth2AccessToken token)
TokenStore
readAuthentication
in interface TokenStore
token
- The token value under which the authentication is stored.public OAuth2Authentication readAuthentication(String token)
TokenStore
readAuthentication
in interface TokenStore
token
- The token value under which the authentication is stored.public OAuth2Authentication readAuthenticationForRefreshToken(OAuth2RefreshToken token)
readAuthenticationForRefreshToken
in interface TokenStore
token
- a refresh tokenpublic OAuth2Authentication readAuthenticationForRefreshToken(String token)
public void storeAccessToken(OAuth2AccessToken token, OAuth2Authentication authentication)
TokenStore
storeAccessToken
in interface TokenStore
token
- The token to store.authentication
- The authentication associated with the token.public void removeAccessToken(OAuth2AccessToken accessToken)
TokenStore
removeAccessToken
in interface TokenStore
accessToken
- The token to remove from the store.public OAuth2AccessToken readAccessToken(String tokenValue)
TokenStore
readAccessToken
in interface TokenStore
tokenValue
- The token value.public void removeAccessToken(String tokenValue)
public void storeRefreshToken(OAuth2RefreshToken refreshToken, OAuth2Authentication authentication)
TokenStore
storeRefreshToken
in interface TokenStore
refreshToken
- The refresh token to store.authentication
- The authentication associated with the refresh token.public OAuth2RefreshToken readRefreshToken(String tokenValue)
TokenStore
readRefreshToken
in interface TokenStore
tokenValue
- The value of the token to read.public void removeRefreshToken(OAuth2RefreshToken refreshToken)
TokenStore
removeRefreshToken
in interface TokenStore
refreshToken
- The token to remove from the store.public void removeRefreshToken(String tokenValue)
public void removeAccessTokenUsingRefreshToken(OAuth2RefreshToken refreshToken)
TokenStore
removeAccessTokenUsingRefreshToken
in interface TokenStore
refreshToken
- The refresh token.public Collection<OAuth2AccessToken> findTokensByClientIdAndUserName(String clientId, String userName)
findTokensByClientIdAndUserName
in interface TokenStore
clientId
- the client id to searchuserName
- the user name to searchpublic Collection<OAuth2AccessToken> findTokensByClientId(String clientId)
findTokensByClientId
in interface TokenStore
clientId
- the client id to searchCopyright © 2019. All rights reserved.