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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
CanonicalJWKS returns the canonical document only for the static variant.
func (KeySource) Equal ¶
Equal reports whether two sources select the same variant and, for static sources, the same canonical key document.