jwks

package
v2.0.0-...-3dee013 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2022 License: MIT Imports: 9 Imported by: 1

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.

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.

func (*CachingProvider) KeyFunc

func (c *CachingProvider) KeyFunc(ctx context.Context) (interface{}, error)

KeyFunc adheres to the keyFunc signature that the Validator requires. While it returns an interface to adhere to keyFunc, as long as the error is nil the type will be *jose.JSONWebKeySet.

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.

func (*Provider) KeyFunc

func (p *Provider) KeyFunc(ctx context.Context) (interface{}, error)

KeyFunc adheres to the keyFunc signature that the Validator requires. While it returns an interface to adhere to keyFunc, as long as the error is nil the type will be *jose.JSONWebKeySet.

type ProviderOption

type ProviderOption func(*Provider)

ProviderOption is how options for the Provider are set up.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL