Documentation
¶
Overview ¶
Package jwkscache contains utils to manage a cache of a JWK Set (via jwk.Set). It supports retrieving a JWKS from:
- A path on the local disk. This is watched with fsnotify to automatically reload the JWKS when the file changes on disk. - A HTTP(S) URL. This is automatically refreshed if a caller requests a key that isn't in the cached set. - A JWKS passed during initialization, optionally base64-encoded.
Index ¶
- type JWKSCache
- func (c *JWKSCache) KeySet() jwk.Set
- func (c *JWKSCache) SetCACertificate(caCertificate string)
- func (c *JWKSCache) SetHTTPClient(client *http.Client)
- func (c *JWKSCache) SetMinRefreshInterval(minRefreshInterval time.Duration)
- func (c *JWKSCache) SetRequestTimeout(requestTimeout time.Duration)
- func (c *JWKSCache) Start(ctx context.Context) error
- func (c *JWKSCache) WaitForCacheReady(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JWKSCache ¶
type JWKSCache struct {
// contains filtered or unexported fields
}
JWKSCache is a cache of JWKS objects. It fetches a JWKS object from a file on disk, a URL, or from a value passed as-is.
func NewJWKSCache ¶
NewJWKSCache creates a new JWKSCache object.
func (*JWKSCache) SetCACertificate ¶ added in v0.13.0
SetCACertificate sets the CA certificate to trust. Can be a path to a local file or an actual, PEM-encoded certificate
func (*JWKSCache) SetHTTPClient ¶
SetHTTPClient sets the HTTP client object to use.
func (*JWKSCache) SetMinRefreshInterval ¶
SetMinRefreshInterval sets the minimum interval for refreshing a JWKS from a URL if a key is not found in the cache.
func (*JWKSCache) SetRequestTimeout ¶
SetRequestTimeout sets the timeout for network requests.