Package com.nimbusds.jose.jwk.source
Class RetryingJWKSetSource<C extends SecurityContext>
- java.lang.Object
-
- com.nimbusds.jose.jwk.source.JWKSetSourceWrapper<C>
-
- com.nimbusds.jose.jwk.source.RetryingJWKSetSource<C>
-
- All Implemented Interfaces:
JWKSetSource<C>
,Closeable
,AutoCloseable
@ThreadSafe public class RetryingJWKSetSource<C extends SecurityContext> extends JWKSetSourceWrapper<C>
JWKSetSource with with retry capability to work around transient network issues. In cases when the underlying source throws a JWKSetUnavailableException the retrieval is tried once again.- Version:
- 2022-11-22
- Author:
- Thomas Rørvik Skjølberg
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RetryingJWKSetSource.RetrialEvent<C extends SecurityContext>
Retrial event.
-
Constructor Summary
Constructors Constructor Description RetryingJWKSetSource(JWKSetSource<C> source, EventListener<RetryingJWKSetSource<C>,C> eventListener)
Creates a new JWK set source with support for retrial.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JWKSet
getJWKSet(JWKSetCacheRefreshEvaluator refreshEvaluator, long currentTime, C context)
Gets the JWK set.-
Methods inherited from class com.nimbusds.jose.jwk.source.JWKSetSourceWrapper
close, getSource
-
-
-
-
Constructor Detail
-
RetryingJWKSetSource
public RetryingJWKSetSource(JWKSetSource<C> source, EventListener<RetryingJWKSetSource<C>,C> eventListener)
Creates a new JWK set source with support for retrial.- Parameters:
source
- The JWK set source to decorate. Must not benull
.eventListener
- The event listener,null
if not specified.
-
-
Method Detail
-
getJWKSet
public JWKSet getJWKSet(JWKSetCacheRefreshEvaluator refreshEvaluator, long currentTime, C context) throws KeySourceException
Description copied from interface:JWKSetSource
Gets the JWK set.- Parameters:
refreshEvaluator
- Controls whether refresh of the JWK set cache (if utilised by the source) is required.currentTime
- The current time, in milliseconds since the Unix epoch.context
- Optional context,null
if not required.- Returns:
- The JWK set.
- Throws:
KeySourceException
- If JWK set retrieval failed.
-
-