jwks

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2022 License: Apache-2.0 Imports: 15 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

func ServeFakeOIDCEndpoint

func ServeFakeOIDCEndpoint(t *testing.T, keyset KeySet) (string, func())

ServeFakeOIDCEndpoint is a test helper for serving a OIDC endpoint from a static keyset.

Types

type KeyProvider

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

	// LookupKey should return a PublicKey based on the given key ID. Return an error if not
	// found or any other error.
	LookupKey(ctx context.Context, kid string) (*rsa.PublicKey, 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, baseURL string) (KeyProvider, error)

NewCachingOIDCJWKKeyProvider creates a CachingKeyProvider based on the auth0 url and starts the auto refresh. must call CachingKeyProvider.Stop() to stop background goroutine. Use {baseUrl}.well-known/jwks.json.

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.

Jump to

Keyboard shortcuts

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