
@Component public class TokenCache extends Object
| Modifier and Type | Field and Description |
|---|---|
private int |
accessTokenExpirationInSeconds |
private org.springframework.cache.Cache |
accessTokenToEntry |
private org.springframework.cache.CacheManager |
cm |
private net.trajano.ms.core.CryptoOps |
cryptoOps |
private static org.slf4j.Logger |
LOG
Logger for TokenCache
|
private org.springframework.cache.Cache |
refreshTokenToEntry |
| Constructor and Description |
|---|
TokenCache() |
| Modifier and Type | Method and Description |
|---|---|
private void |
evictEntry(TokenCacheEntry cacheEntry)
Evicts the entry from the caches.
|
IdTokenResponse |
get(String accessToken)
This will return null if a valid entry was not found.
|
TokenCacheEntry |
getCacheEntry(String accessToken)
This will return null if a valid entry was not found.
|
void |
init() |
OAuthTokenResponse |
refresh(String refreshToken,
String clientId) |
void |
revokeRefreshToken(String refreshToken,
String clientId)
Revokes the refresh token and associated access token.
|
OAuthTokenResponse |
store(String jwt,
Collection<String> audiences,
Instant expiresOn)
Stores the internal claims set into the cache and returns an OAuth token.
|
private OAuthTokenResponse |
updateEntry(TokenCacheEntry cacheEntry)
Stores the cache entry into the caches with updated tokens.
|
private static final org.slf4j.Logger LOG
@Value(value="${token.accessTokenExpiration:300}")
private int accessTokenExpirationInSeconds
private org.springframework.cache.Cache accessTokenToEntry
@Autowired private org.springframework.cache.CacheManager cm
@Autowired private net.trajano.ms.core.CryptoOps cryptoOps
private org.springframework.cache.Cache refreshTokenToEntry
private void evictEntry(TokenCacheEntry cacheEntry)
cacheEntry - cache entry.public IdTokenResponse get(String accessToken)
accessToken - access tokenpublic TokenCacheEntry getCacheEntry(String accessToken)
accessToken - access token@PostConstruct public void init()
public OAuthTokenResponse refresh(String refreshToken, String clientId)
public void revokeRefreshToken(String refreshToken, String clientId)
refreshToken - refreshTokenclientId - client IDpublic OAuthTokenResponse store(String jwt, Collection<String> audiences, Instant expiresOn)
jwt - JWT to storeaudiences - audience client IDs, this is usually the gateway.expiresOn - JWT expirationprivate OAuthTokenResponse updateEntry(TokenCacheEntry cacheEntry)
cacheEntry - entry to storeCopyright © 2012–2017 Trajano. All rights reserved.