jwkssource

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package jwkssource owns the closed representation and parsing policy for a federation issuer's signing-key source. It is a leaf shared by the wire, store facade, and verifier; it performs no fetches and imports no service or persistence package.

Index

Constants

View Source
const MaxJWKSBytes = 1 << 20

MaxJWKSBytes is the shared admission cap for static and remote JWKS documents. Both sources must carry the same bounded key policy.

Variables

View Source
var ErrKeySource = errors.New("jwkssource: invalid issuer key source")

ErrKeySource reports a wire or stored representation that is not exactly one of remote discovery or a validated static JWKS document.

Functions

func ParseJWKS

func ParseJWKS(body []byte) ([]crypto.PublicKey, map[string]bool, error)

ParseJWKS turns a document into fresh public keys through go-jose. This is key parsing, not verification: go-oidc performs the signature check against the returned keys. A rotation publishes old and new keys together, so both enter the set and tokens signed by either continue to verify.

Types

type KeySource

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

KeySource is the closed value RemoteDiscovery | Static{CanonicalJWKS}.

Its zero value is remote discovery. The static arm is private and can only be created by ParseKeySource, which validates and canonicalizes the document. That makes the former mode/static pair's impossible combinations unrepresentable everywhere after the wire or storage boundary.

func ParseKeySource

func ParseKeySource(mode domain.JWKSMode, staticJWKS *string) (KeySource, error)

ParseKeySource converts the compatible wire representation into its closed value. Presence matters: discovery with even an empty static_jwks property is not the remote variant, and static without the property is not the static variant.

func ParseStoredKeySource

func ParseStoredKeySource(mode domain.JWKSMode, staticJWKS string, present bool) (KeySource, error)

ParseStoredKeySource converts the existing two database columns into their closed value. Stored rows are validated on read so corruption fails loud instead of selecting a source by accident. Valid legacy static documents are canonicalized in memory without requiring a migration.

func RemoteDiscovery

func RemoteDiscovery() KeySource

RemoteDiscovery returns the remote-discovery variant.

func (KeySource) CanonicalJWKS

func (s KeySource) CanonicalJWKS() (string, bool)

CanonicalJWKS returns the canonical document only for the static variant.

func (KeySource) Equal

func (s KeySource) Equal(other KeySource) bool

Equal reports whether two sources select the same variant and, for static sources, the same canonical key document.

func (KeySource) Mode

func (s KeySource) Mode() domain.JWKSMode

Mode returns the compatibility value used by the API and existing columns.

func (KeySource) StorageColumns

func (s KeySource) StorageColumns() (domain.JWKSMode, string)

StorageColumns maps the closed value to the existing compatible columns.

Jump to

Keyboard shortcuts

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