Class JwksStoreService
- java.lang.Object
-
- org.forgerock.json.jose.jwk.store.JwksStoreService
-
public class JwksStoreService extends Object
Manage the jwks store, to avoid having more than one jwks store for the same JWKs_URI unnecessary.
-
-
Field Summary
Fields Modifier and Type Field Description static Duration
JWKS_STORE_DEFAULT_CACHE_MISS_CACHE_TIME_MS
The default cache time before reload the cache in case of cache miss ms.static Duration
JWKS_STORE_DEFAULT_CACHE_TIMEOUT_MS
The default cache timeout in ms.
-
Constructor Summary
Constructors Constructor Description JwksStoreService()
Deprecated.Prefer using the constructorJwksStoreService(Client client)
in which you provide your own instance ofClient
.JwksStoreService(int readTimeout, int connTimeout)
Deprecated.Prefer using the constructorJwksStoreService(Client client)
where timeouts are in control of the client applicationJwksStoreService(Client client)
Constructor with a HTTP client, that will be used to connect to the JWKS_URI.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description JwksStore
configureJwksStore(String uid, Duration cacheTimeout, Duration cacheMissCacheTime, URL jwkUrl)
Deprecated.UseconfigureJwksStore(String, Duration, Duration, URL, Clock)
with an explicit clock.JwksStore
configureJwksStore(String uid, Duration cacheTimeout, Duration cacheMissCacheTime, URL jwkUrl, Clock clock)
Deprecated.Promise<JwksStore,FailedToLoadJWKException>
configureJwksStoreAsync(String uid, Duration cacheTimeout, Duration cacheMissCacheTime, URL jwkUrl, Clock clock)
Configure a JWKs store.JwksStore
getJwksStore(String uid)
Returns the appropriate JWKs store.void
removeJwksStore(String uid)
Remove the corresponding jwks store if exist.
-
-
-
Field Detail
-
JWKS_STORE_DEFAULT_CACHE_TIMEOUT_MS
public static final Duration JWKS_STORE_DEFAULT_CACHE_TIMEOUT_MS
The default cache timeout in ms.
-
JWKS_STORE_DEFAULT_CACHE_MISS_CACHE_TIME_MS
public static final Duration JWKS_STORE_DEFAULT_CACHE_MISS_CACHE_TIME_MS
The default cache time before reload the cache in case of cache miss ms.
-
-
Constructor Detail
-
JwksStoreService
@Deprecated public JwksStoreService()
Deprecated.Prefer using the constructorJwksStoreService(Client client)
in which you provide your own instance ofClient
. This one does instantiate a specific instance of AsyncHttpClient but does not allow any custom filter processing, nor does it close it properly.Default constructor.
-
JwksStoreService
@Deprecated public JwksStoreService(int readTimeout, int connTimeout)
Deprecated.Prefer using the constructorJwksStoreService(Client client)
where timeouts are in control of the client applicationConstructor with read and connection timeout. It's used for the connection to the JWKs_URI.- Parameters:
readTimeout
- the read timeoutconnTimeout
- the connection timeout
-
JwksStoreService
public JwksStoreService(Client client)
Constructor with a HTTP client, that will be used to connect to the JWKS_URI.- Parameters:
client
- the HTTP client
-
-
Method Detail
-
getJwksStore
public JwksStore getJwksStore(String uid)
Returns the appropriate JWKs store.- Parameters:
uid
- Reference to the jwks store. Note that the uid check is case insensitive- Returns:
- a JWKs Store for the corresponding UID. If doesn't exist, returns null
-
configureJwksStore
@Deprecated public JwksStore configureJwksStore(String uid, Duration cacheTimeout, Duration cacheMissCacheTime, URL jwkUrl) throws FailedToLoadJWKException
Deprecated.UseconfigureJwksStore(String, Duration, Duration, URL, Clock)
with an explicit clock.Configure a JWKs store.- Parameters:
uid
- the unique identifier for this storecacheTimeout
- a cache timeout to avoid reloading the cache all the time when doing encryptioncacheMissCacheTime
- the cache time before reload the cache in case of cache miss.jwkUrl
- the jwk url hosted by the client application- Returns:
- the JWKs store corresponding
- Throws:
FailedToLoadJWKException
- if the jwks can't be reloaded.
-
configureJwksStore
@Deprecated public JwksStore configureJwksStore(String uid, Duration cacheTimeout, Duration cacheMissCacheTime, URL jwkUrl, Clock clock) throws FailedToLoadJWKException
Deprecated.Configure a JWKs store.- Parameters:
uid
- the unique identifier for this storecacheTimeout
- a cache timeout to avoid reloading the cache all the time when doing encryptioncacheMissCacheTime
- the cache time before reload the cache in case of cache miss.jwkUrl
- the jwk url hosted by the client applicationclock
- clock to use for measuring timeouts.- Returns:
- the JWKs store corresponding
- Throws:
FailedToLoadJWKException
- if the jwks can't be reloaded.
-
configureJwksStoreAsync
public Promise<JwksStore,FailedToLoadJWKException> configureJwksStoreAsync(String uid, Duration cacheTimeout, Duration cacheMissCacheTime, URL jwkUrl, Clock clock)
Configure a JWKs store.- Parameters:
uid
- the unique identifier for this storecacheTimeout
- a cache timeout to avoid reloading the cache all the time when doing encryptioncacheMissCacheTime
- the cache time before reload the cache in case of cache miss.jwkUrl
- the jwk url hosted by the client applicationclock
- clock to use for measuring timeouts.- Returns:
- the JWKs store corresponding
-
removeJwksStore
public void removeJwksStore(String uid)
Remove the corresponding jwks store if exist.- Parameters:
uid
- the uid. Note that the uid check isn't case sensitive
-
-