Documentation
¶
Overview ¶
Package jwtjwks implements signed JWT validation using RFC 8414 discovery and a bounded JWKS cache. Importing it registers the "jwt-jwks" authz driver.
Index ¶
Constants ¶
View Source
const DriverName = "jwt-jwks"
DriverName is the name this validator driver registers under.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// AllowedAlgorithms is mandatory and limits both JWT headers and usable JWKs.
AllowedAlgorithms []string `json:"allowed_algorithms"`
HTTPClient *http.Client `json:"-"`
// MaxResponseBytes bounds each discovery or JWKS document (default 1 MiB).
MaxResponseBytes int64 `json:"max_response_bytes,omitempty"`
// MaxKeys bounds the number of keys in one JWKS document (default 32).
MaxKeys int `json:"max_keys,omitempty"`
// CacheTTL controls successful JWKS retention (default 15 minutes).
CacheTTL time.Duration `json:"cache_ttl,omitempty"`
// RefreshCooldown rate-limits repeated JWKS refresh attempts (default 5 seconds).
RefreshCooldown time.Duration `json:"refresh_cooldown,omitempty"`
// ClockSkew is JWT time-claim leeway (default zero).
ClockSkew time.Duration `json:"clock_skew,omitempty"`
Now func() time.Time `json:"-"`
}
Config controls bounded discovery and key caching. Zero values receive secure defaults. AllowedAlgorithms must explicitly contain only RS256, RS384, RS512, ES256, ES384, or ES512. MaxResponseBytes is constrained to 1 KiB..4 MiB, MaxKeys to 1..128, CacheTTL to 1 second..24 hours, RefreshCooldown to 1 second..5 minutes, and ClockSkew to 0..5 minutes.
Click to show internal directories.
Click to hide internal directories.