Package com.auth0.jwk
Class JwkProviderBuilder
java.lang.Object
com.auth0.jwk.JwkProviderBuilder
JwkProvider builder
-
Constructor Summary
ConstructorsConstructorDescriptionJwkProviderBuilder
(String domain) Creates a new Builder with a domain where to look for the jwks.JwkProviderBuilder
(URL url) Creates a new Builder with the given URL where to load the jwks from. -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Creates aJwkProvider
cached
(boolean cached) Toggle the cache of Jwk.Enable the cache specifying size and expire time.Enable the cache specifying size and expire time.Sets the headers to send on the request.Sets the proxy to use for the connection.rateLimited
(boolean rateLimited) Toggle the rate limit of Jwk.rateLimited
(long bucketSize, long refillRate, TimeUnit unit) Enable the cache specifying size and expire time.timeouts
(int connectTimeout, int readTimeout) Sets a custom connect and read timeout values.
-
Constructor Details
-
JwkProviderBuilder
Creates a new Builder with the given URL where to load the jwks from.- Parameters:
url
- to load the jwks- Throws:
IllegalStateException
- if url is null
-
JwkProviderBuilder
Creates a new Builder with a domain where to look for the jwks.
It can be a url link 'https://samples.auth0.com' or just a domain 'samples.auth0.com'. If the protocol (http or https) is not provided then https is used by default. The default jwks path "/.well-known/jwks.json" is appended to the given string domain.
For example, when the domain is "samples.auth0.com" the jwks url that will be used is "https://samples.auth0.com/.well-known/jwks.json"
UseJwkProviderBuilder(URL)
if you need to pass a full URL.- Parameters:
domain
- where jwks is published- Throws:
IllegalStateException
- if domain is null- See Also:
-
-
Method Details
-
cached
Toggle the cache of Jwk. By default, the provider will use a cache size of 5 and a duration of 10 hours.- Parameters:
cached
- if the provider should cache jwks- Returns:
- the builder
-
cached
Enable the cache specifying size and expire time.- Parameters:
cacheSize
- number of jwk to cacheexpiresIn
- amount of time the jwk will be cached- Returns:
- the builder
-
cached
Enable the cache specifying size and expire time.- Parameters:
cacheSize
- number of jwk to cacheexpiresIn
- amount of time the jwk will be cachedunit
- unit of time for the expire of jwk- Returns:
- the builder
-
rateLimited
Toggle the rate limit of Jwk. By default the Provider will use rate limit.- Parameters:
rateLimited
- if the provider should rate limit jwks- Returns:
- the builder
-
rateLimited
Enable the cache specifying size and expire time.- Parameters:
bucketSize
- max number of jwks to deliver in the given rate.refillRate
- amount of time to wait before a jwk can the jwk will be cachedunit
- unit of time for the expire of jwk- Returns:
- the builder
-
proxied
Sets the proxy to use for the connection.- Parameters:
proxy
- proxy server to use when making this connection- Returns:
- the builder
-
timeouts
Sets a custom connect and read timeout values. When this method is not called, the default timeout values will be those defined by theUrlJwkProvider
implementation.- Parameters:
connectTimeout
- connection timeout in milliseconds.readTimeout
- read timeout in milliseconds.- Returns:
- the builder
- See Also:
-
headers
Sets the headers to send on the request. Any headers set here will override the default headers ("Accept": "application/json")- Parameters:
headers
- a map of header keys to values to send on the request.- Returns:
- this builder instance
-
build
Creates aJwkProvider
- Returns:
- a newly created
JwkProvider
-