Package com.nimbusds.jose.jwk.source
Class JWKSourceWithFailover<C extends SecurityContext>
- java.lang.Object
-
- com.nimbusds.jose.jwk.source.JWKSourceWithFailover<C>
-
- All Implemented Interfaces:
JWKSource<C>
,Closeable
,AutoCloseable
@ThreadSafe public class JWKSourceWithFailover<C extends SecurityContext> extends Object implements JWKSource<C>, Closeable
JWK source with optional failover.- Version:
- 2022-08-24
- Author:
- Thomas Rørvik Skjølberg, Vladimir Dzhuvinov
-
-
Constructor Summary
Constructors Constructor Description JWKSourceWithFailover(JWKSource<C> jwkSource, JWKSource<C> failoverJWKSource)
Creates a new JWK source with optional failover.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
List<JWK>
get(JWKSelector jwkSelector, C context)
Retrieves a list of JWKs matching the specified selector.
-
-
-
Constructor Detail
-
JWKSourceWithFailover
public JWKSourceWithFailover(JWKSource<C> jwkSource, JWKSource<C> failoverJWKSource)
Creates a new JWK source with optional failover.- Parameters:
jwkSource
- The primary JWK source. Must not benull
.failoverJWKSource
- Optional failover JWK source if retrieval from the primary JWK source fails,null
if no failover.
-
-
Method Detail
-
get
public List<JWK> get(JWKSelector jwkSelector, C context) throws KeySourceException
Description copied from interface:JWKSource
Retrieves a list of JWKs matching the specified selector.- Specified by:
get
in interfaceJWKSource<C extends SecurityContext>
- Parameters:
jwkSelector
- A JWK selector. Must not benull
.context
- Optional context,null
if not required.- Returns:
- The matching JWKs, empty list if no matches were found.
- Throws:
KeySourceException
- If key sourcing failed.
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
-