Class CachingAccessTokenResolver
- java.lang.Object
-
- org.forgerock.http.oauth2.resolver.CachingAccessTokenResolver
-
- All Implemented Interfaces:
AccessTokenResolver
public class CachingAccessTokenResolver extends Object implements AccessTokenResolver
ACachingAccessTokenResolver
is a delegatingAccessTokenResolver
that uses a write-through cache to enable fastAccessTokenInfo
resolution.
-
-
Constructor Summary
Constructors Constructor Description CachingAccessTokenResolver(Clock clock, AccessTokenResolver resolver, PerItemEvictionStrategyCache<String,Promise<AccessTokenInfo,AccessTokenException>> cache)
Builds aCachingAccessTokenResolver
delegating to the givenAccessTokenResolver
using the given (pre-configured) cache.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Promise<AccessTokenInfo,AccessTokenException>
resolve(Context context, Supplier<Request,IOException> request, String token)
Resolves a given access token against an authorization server.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.forgerock.http.oauth2.AccessTokenResolver
resolve
-
-
-
-
Constructor Detail
-
CachingAccessTokenResolver
public CachingAccessTokenResolver(Clock clock, AccessTokenResolver resolver, PerItemEvictionStrategyCache<String,Promise<AccessTokenInfo,AccessTokenException>> cache)
Builds aCachingAccessTokenResolver
delegating to the givenAccessTokenResolver
using the given (pre-configured) cache.- Parameters:
clock
- Clock used to compute the token cache time-to-liveresolver
- resolver to delegates tocache
- access token cache
-
-
Method Detail
-
resolve
public Promise<AccessTokenInfo,AccessTokenException> resolve(Context context, Supplier<Request,IOException> request, String token)
Description copied from interface:AccessTokenResolver
Resolves a given access token against an authorization server.- Specified by:
resolve
in interfaceAccessTokenResolver
- Parameters:
context
- Context chain used to keep a relationship between requests (tracking)request
- a supplier for the HTTP request the access token was presented on. The request should be defensively copied by the caller in case the resolver needs to consume the entity.token
- token identifier to be resolved- Returns:
- a promise completed either with a valid
AccessTokenInfo
(well-formed, known by the server), or by an exception
-
-