Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CachingProvider ¶
type CachingProvider struct { *Provider CacheTTL time.Duration // contains filtered or unexported fields }
CachingProvider handles getting JWKS from the specified IssuerURL and caching them for CacheTTL time. It exposes KeyFunc which adheres to the keyFunc signature that the Validator requires. When the CacheTTL value has been reached, a JWKS refresh will be triggered in the background and the existing cached JWKS will be returned until the JWKS cache is updated, or if the request errors then it will be evicted from the cache.
func NewCachingProvider ¶
func NewCachingProvider(issuerURL *url.URL, cacheTTL time.Duration, opts ...ProviderOption) *CachingProvider
NewCachingProvider builds and returns a new CachingProvider. If cacheTTL is zero then a default value of 1 minute will be used.
type Provider ¶
type Provider struct { IssuerURL *url.URL // Required. CustomJWKSURI *url.URL // Optional. Client *http.Client }
Provider handles getting JWKS from the specified IssuerURL and exposes KeyFunc which adheres to the keyFunc signature that the Validator requires. Most likely you will want to use the CachingProvider as it handles getting and caching JWKS which can help reduce request time and potential rate limiting from your provider.
func NewProvider ¶
func NewProvider(issuerURL *url.URL, opts ...ProviderOption) *Provider
NewProvider builds and returns a new *Provider.
type ProviderOption ¶
type ProviderOption func(*Provider)
ProviderOption is how options for the Provider are set up.
func WithCustomClient ¶ added in v2.1.0
func WithCustomClient(c *http.Client) ProviderOption
WithCustomClient will set a custom *http.Client on the *Provider
func WithCustomJWKSURI ¶
func WithCustomJWKSURI(jwksURI *url.URL) ProviderOption
WithCustomJWKSURI will set a custom JWKS URI on the *Provider and call this directly inside the keyFunc in order to fetch the JWKS, skipping the oidc.GetWellKnownEndpointsFromIssuerURL call.