jwksx

package
v0.0.674 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: Apache-2.0 Imports: 26 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnableToFindKeyID = errors.New("specified JWK kid can not be found in the JWK sets")

Functions

func GenerateSigningKeys added in v0.0.60

func GenerateSigningKeys(id, alg string, bits int) (*jose.JSONWebKeySet, error)

GenerateSigningKeys generates a JSON Web Key Set for signing.

func GenerateSigningKeysAvailableAlgorithms added in v0.0.60

func GenerateSigningKeysAvailableAlgorithms() []string

GenerateSigningKeysAvailableAlgorithms lists available algorithms that are supported by GenerateSigningKeys.

Types

type Fetcher

type Fetcher struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Fetcher is a small helper for fetching JSON Web Keys from remote endpoints.

DEPRECATED: Use FetcherNext instead.

func NewFetcher

func NewFetcher(remote string) *Fetcher

NewFetcher returns a new fetcher that can download JSON Web Keys from remote endpoints.

DEPRECATED: Use FetcherNext instead.

func (*Fetcher) GetKey

func (f *Fetcher) GetKey(kid string) (*jose.JSONWebKey, error)

GetKey retrieves a JSON Web Key from the cache, fetches it from a remote if it is not yet cached or returns an error.

DEPRECATED: Use FetcherNext instead.

type FetcherNext added in v0.0.586

type FetcherNext struct {
	// contains filtered or unexported fields
}

FetcherNext is a JWK fetcher that can be used to fetch JWKs from multiple locations.

func NewFetcherNext added in v0.0.586

func NewFetcherNext(cache *ristretto.Cache[[]byte, jwk.Set]) *FetcherNext

NewFetcherNext returns a new FetcherNext instance.

func (*FetcherNext) ResolveKey added in v0.0.586

func (f *FetcherNext) ResolveKey(ctx context.Context, locations string, modifiers ...FetcherNextOption) (jwk.Key, error)

func (*FetcherNext) ResolveKeyFromLocations added in v0.0.586

func (f *FetcherNext) ResolveKeyFromLocations(ctx context.Context, locations []string, modifiers ...FetcherNextOption) (jwk.Key, error)

type FetcherNextOption added in v0.0.586

type FetcherNextOption func(*fetcherNextOptions)

FetcherNextOption is a functional option for the FetcherNext.

func WithCacheEnabled added in v0.0.586

func WithCacheEnabled() FetcherNextOption

WithCacheEnabled enables the cache.

func WithCacheTTL added in v0.0.586

func WithCacheTTL(ttl time.Duration) FetcherNextOption

WithCacheTTL sets the cache TTL. If not set, the TTL is unlimited.

func WithForceKID added in v0.0.586

func WithForceKID(kid string) FetcherNextOption

WithForceKID forces the key ID to be used. Required when multiple JWK sets are configured.

func WithHTTPClient added in v0.0.586

func WithHTTPClient(c *retryablehttp.Client) FetcherNextOption

WithHTTPClient will use the given HTTP client to fetch the JSON Web Keys.

Jump to

Keyboard shortcuts

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