jwks

package
v0.1.98 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Overview

Package jwks provides helpers for working with json key sets.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeyProvider

type KeyProvider interface {
	// allow users to stop any background process in a key provider.
	io.Closer

	// LookupKey should return a public key based on the given key ID. Return an error if not
	// found or any other error.
	LookupKey(ctx context.Context, kid, alg string) (interface{}, error)

	// Fetch returns the full KeySet as a cloned keyset, any modifcations are only applied locally.
	Fetch(ctx context.Context) (KeySet, error)
}

KeyProvider provides an interface to lookup keys based on a key ID. Providers may have a background process to refresh keys and allows it to be closed.

func NewCachingOIDCJWKKeyProvider

func NewCachingOIDCJWKKeyProvider(ctx context.Context, issuer string) (KeyProvider, error)

NewCachingOIDCJWKKeyProvider creates a CachingKeyProvider based on the issuer url base domain and starts the auto refresh. Call CachingKeyProvider.Stop() to stop any background goroutines.

func NewStaticJWKKeyProvider

func NewStaticJWKKeyProvider(keyset KeySet) KeyProvider

NewStaticJWKKeyProvider create static key provider based on the keyset given.

type KeySet

type KeySet jwk.Set

KeySet represents json key set object, a collection of jwk.Key objects. See jwk docs. github.com/lestrrat-go/jwx/jwk.

func ParseKeySet added in v0.1.5

func ParseKeySet(input string) (KeySet, error)

ParseKeySet parses a JSON keyset string into a KeySet.

Directories

Path Synopsis
Package jwksutils contains helper utilities and tests for the jwks module
Package jwksutils contains helper utilities and tests for the jwks module

Jump to

Keyboard shortcuts

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