The idea to keep with you
When an IdP generates `k2`, replaces `k1` in `/, never sign JWTs with a new kid until every verifier cache has expired past the publish window, and coalesce unknown-kid refreshes with singleflight + negative cooldowns.
TL;DR30-second simplified summary▾
Abrupt JWKS rotations trigger 401s from stale 24h caches, while naive unknown-kid fallbacks enable thundering-herd DoS attacks. Solve both with 3-phase overlap rotation (publish [k1, k2] -> wait max TTL -> sign k2 -> wait max exp -> retire k1), max-age=300 caching, singleflight locking, and 30s unknown-kid cooldowns.
Before you begin · Building blocksAlready know these? Jump to Stage 01 ↓
SPIFFE & SPIRE Cryptographic Workload Identity
SPIFFE defines a universal URI-based workload identity standard, while SPIRE attests running processes via kernel and cloud metadata to issue short-lived X.509/JWT SVIDs over a local Unix Domain Socket.
API Security: OAuth 2.1, JWT & mTLS
Modern API security pairs OAuth 2.0 (for delegated user/client authorization), signed JWTs (for stateless, verifiable claims), and Mutual TLS (mTLS) (for cryptographic workload and high-assurance client identity).
Circuit Breaker Pattern
A stateful proxy that monitors downstream failures and slow calls over a sliding window, tripping open to fail fast in microseconds instead of letting 2,000ms+ timeouts exhaust caller thread pools.
Full walkthrough · 7 stages
01
L4 · FUNDAMENTALS
.
02
L4 · FUNDAMENTALS
.
03
L5 · APPLIED DESIGN
.
04
L5 · APPLIED DESIGN
.
05
L6 · SCALE & TRADE-OFFS
.
06
L6 · SCALE & TRADE-OFFS
.
07
L7 · STAFF / PRINCIPAL
.
Practice · Explain the consequences
Practice: Make the trade-off yourself.
Question 1 of 3
Score: 0/3Why is an unthrottled 'fetch JWKS on unknown kid' fallback dangerous even when the IdP is not rotating keys?
Recommended Learning Flow