Package com.nimbusds.jose.jwk.source
Class RemoteJWKSet<C extends SecurityContext>
- java.lang.Object
-
- com.nimbusds.jose.jwk.source.RemoteJWKSet<C>
-
- All Implemented Interfaces:
JWKSource<C>
@ThreadSafe @Deprecated public class RemoteJWKSet<C extends SecurityContext> extends Object implements JWKSource<C>
Deprecated.Construct a JWKSource using JWKSourceBuilder.Remote JSON Web Key (JWK) source specified by a JWK set URL. The retrieved JWK set is cached to minimise network calls. The cache is updated whenever the key selector tries to get a key with an unknown ID or the cache expires.If no
ResourceRetriever
is specified when creating a remote JWK set source thedefault one
will be used, with the following HTTP timeouts and limits:- HTTP connect timeout, in milliseconds: Determined by the
DEFAULT_HTTP_CONNECT_TIMEOUT
constant which can be overridden by setting thecom.nimbusds.jose.jwk.source.RemoteJWKSet.defaultHttpConnectTimeout
Java system property. - HTTP read timeout, in milliseconds: Determined by the
DEFAULT_HTTP_READ_TIMEOUT
constant which can be overridden by setting thecom.nimbusds.jose.jwk.source.RemoteJWKSet.defaultHttpReadTimeout
Java system property. - HTTP entity size limit: Determined by the
DEFAULT_HTTP_SIZE_LIMIT
constant which can be overridden by setting thecom.nimbusds.jose.jwk.source.RemoteJWKSet.defaultHttpSizeLimit
Java system property.
A failover JWK source can be configured in case the JWK set URL becomes unavailable (HTTP 404) or times out. The failover JWK source can be another URL or some other object.
- Version:
- 2022-01-30
- Author:
- Vladimir Dzhuvinov, Andreas Huber
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_HTTP_CONNECT_TIMEOUT
Deprecated.The default HTTP connect timeout for JWK set retrieval, in milliseconds.static int
DEFAULT_HTTP_READ_TIMEOUT
Deprecated.The default HTTP read timeout for JWK set retrieval, in milliseconds.static int
DEFAULT_HTTP_SIZE_LIMIT
Deprecated.The default HTTP entity size limit for JWK set retrieval, in bytes.
-
Constructor Summary
Constructors Constructor Description RemoteJWKSet(URL jwkSetURL)
Deprecated.Creates a new remote JWK set using thedefault HTTP resource retriever
with the default HTTP timeouts and entity size limit.RemoteJWKSet(URL jwkSetURL, JWKSource<C> failoverJWKSource)
Deprecated.Creates a new remote JWK set using thedefault HTTP resource retriever
with the default HTTP timeouts and entity size limit.RemoteJWKSet(URL jwkSetURL, JWKSource<C> failoverJWKSource, ResourceRetriever resourceRetriever, JWKSetCache jwkSetCache)
Deprecated.Creates a new remote JWK set.RemoteJWKSet(URL jwkSetURL, ResourceRetriever resourceRetriever)
Deprecated.Creates a new remote JWK set.RemoteJWKSet(URL jwkSetURL, ResourceRetriever resourceRetriever, JWKSetCache jwkSetCache)
Deprecated.Creates a new remote JWK set.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description List<JWK>
get(JWKSelector jwkSelector, C context)
Deprecated.Retrieves a list of JWKs matching the specified selector.JWKSet
getCachedJWKSet()
Deprecated.Returns the cached JWK set.JWKSource<C>
getFailoverJWKSource()
Deprecated.Returns the optional failover JWK source.protected static String
getFirstSpecifiedKeyID(JWKMatcher jwkMatcher)
Deprecated.Returns the first specified key ID (kid) for a JWK matcher.JWKSetCache
getJWKSetCache()
Deprecated.Returns the configured JWK set cache.URL
getJWKSetURL()
Deprecated.Returns the JWK set URL.ResourceRetriever
getResourceRetriever()
Deprecated.Returns the HTTP resource retriever.static int
resolveDefaultHTTPConnectTimeout()
Deprecated.Resolves the default HTTP connect timeout for JWK set retrieval, in milliseconds.static int
resolveDefaultHTTPReadTimeout()
Deprecated.Resolves the default HTTP read timeout for JWK set retrieval, in milliseconds.static int
resolveDefaultHTTPSizeLimit()
Deprecated.Resolves default HTTP entity size limit for JWK set retrieval, in bytes.
-
-
-
Field Detail
-
DEFAULT_HTTP_CONNECT_TIMEOUT
public static final int DEFAULT_HTTP_CONNECT_TIMEOUT
Deprecated.The default HTTP connect timeout for JWK set retrieval, in milliseconds. Set to 500 milliseconds.- See Also:
- Constant Field Values
-
DEFAULT_HTTP_READ_TIMEOUT
public static final int DEFAULT_HTTP_READ_TIMEOUT
Deprecated.The default HTTP read timeout for JWK set retrieval, in milliseconds. Set to 500 milliseconds.- See Also:
- Constant Field Values
-
DEFAULT_HTTP_SIZE_LIMIT
public static final int DEFAULT_HTTP_SIZE_LIMIT
Deprecated.The default HTTP entity size limit for JWK set retrieval, in bytes. Set to 50 KBytes.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RemoteJWKSet
public RemoteJWKSet(URL jwkSetURL)
Deprecated.Creates a new remote JWK set using thedefault HTTP resource retriever
with the default HTTP timeouts and entity size limit.- Parameters:
jwkSetURL
- The JWK set URL. Must not benull
.
-
RemoteJWKSet
public RemoteJWKSet(URL jwkSetURL, JWKSource<C> failoverJWKSource)
Deprecated.Creates a new remote JWK set using thedefault HTTP resource retriever
with the default HTTP timeouts and entity size limit.- Parameters:
jwkSetURL
- The JWK set URL. Must not benull
.failoverJWKSource
- Optional failover JWK source in case retrieval from the JWK set URL fails,null
if no failover is specified.
-
RemoteJWKSet
public RemoteJWKSet(URL jwkSetURL, ResourceRetriever resourceRetriever)
Deprecated.Creates a new remote JWK set.- Parameters:
jwkSetURL
- The JWK set URL. Must not benull
.resourceRetriever
- The HTTP resource retriever to use,null
to use thedefault one
with the default HTTP timeouts and entity size limit.
-
RemoteJWKSet
public RemoteJWKSet(URL jwkSetURL, ResourceRetriever resourceRetriever, JWKSetCache jwkSetCache)
Deprecated.Creates a new remote JWK set.- Parameters:
jwkSetURL
- The JWK set URL. Must not benull
.resourceRetriever
- The HTTP resource retriever to use,null
to use thedefault one
with the default HTTP timeouts and entity size limit.jwkSetCache
- The JWK set cache to use,null
to use thedefault one
.
-
RemoteJWKSet
public RemoteJWKSet(URL jwkSetURL, JWKSource<C> failoverJWKSource, ResourceRetriever resourceRetriever, JWKSetCache jwkSetCache)
Deprecated.Creates a new remote JWK set.- Parameters:
jwkSetURL
- The JWK set URL. Must not benull
.failoverJWKSource
- Optional failover JWK source in case retrieval from the JWK set URL fails,null
if no failover is specified.resourceRetriever
- The HTTP resource retriever to use,null
to use thedefault one
with the default HTTP timeouts and entity size limit.jwkSetCache
- The JWK set cache to use,null
to use thedefault one
.
-
-
Method Detail
-
resolveDefaultHTTPConnectTimeout
public static int resolveDefaultHTTPConnectTimeout()
Deprecated.Resolves the default HTTP connect timeout for JWK set retrieval, in milliseconds.- Returns:
- The
static constant
, overridden by setting thecom.nimbusds.jose.jwk.source.RemoteJWKSet.defaultHttpConnectTimeout
Java system property.
-
resolveDefaultHTTPReadTimeout
public static int resolveDefaultHTTPReadTimeout()
Deprecated.Resolves the default HTTP read timeout for JWK set retrieval, in milliseconds.- Returns:
- The
static constant
, overridden by setting thecom.nimbusds.jose.jwk.source.RemoteJWKSet.defaultHttpReadTimeout
Java system property.
-
resolveDefaultHTTPSizeLimit
public static int resolveDefaultHTTPSizeLimit()
Deprecated.Resolves default HTTP entity size limit for JWK set retrieval, in bytes.- Returns:
- The
static constant
, overridden by setting thecom.nimbusds.jose.jwk.source.RemoteJWKSet.defaultHttpSizeLimit
Java system property.
-
getJWKSetURL
public URL getJWKSetURL()
Deprecated.Returns the JWK set URL.- Returns:
- The JWK set URL.
-
getFailoverJWKSource
public JWKSource<C> getFailoverJWKSource()
Deprecated.Returns the optional failover JWK source.- Returns:
- The failover JWK source,
null
if not specified.
-
getResourceRetriever
public ResourceRetriever getResourceRetriever()
Deprecated.Returns the HTTP resource retriever.- Returns:
- The HTTP resource retriever.
-
getJWKSetCache
public JWKSetCache getJWKSetCache()
Deprecated.Returns the configured JWK set cache.- Returns:
- The JWK set cache.
-
getCachedJWKSet
public JWKSet getCachedJWKSet()
Deprecated.Returns the cached JWK set.- Returns:
- The cached JWK set,
null
if none or expired.
-
getFirstSpecifiedKeyID
protected static String getFirstSpecifiedKeyID(JWKMatcher jwkMatcher)
Deprecated.Returns the first specified key ID (kid) for a JWK matcher.- Parameters:
jwkMatcher
- The JWK matcher. Must not benull
.- Returns:
- The first key ID,
null
if none.
-
get
public List<JWK> get(JWKSelector jwkSelector, C context) throws RemoteKeySourceException
Deprecated.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:
RemoteKeySourceException
-
-