HLDArena
HLD-131·Caching & Consistency
Easy · 500 pts

OAuth 2.0 Authorization Code & PKCE Token Issuer

Design an OAuth 2.0 / OIDC authorization-code exchange and JWKS public-key endpoint that verifies PKCE challenges, enforces single-use auth codes, and serves high-QPS token validation keys.

Max p99
≤ 32 ms
Availability
≥ 99.5%
Budget
≤ $3,200

Functional Requirements

  • FR-1POST /oauth/token — Verifies PKCE code_verifier against stored challenge, consumes auth_code atomically, and issues signed access + refresh tokens.
  • FR-2GET /.well-known/jwks.json — Serves current signing public key set for downstream resource-server JWT verification.
  • FR-3POST /oauth/revoke/{token_id} — Revokes refresh tokens or compromised grants and updates revocation caches.
  • FR-4Must prevent auth_code replay (read-after-write consumption) and sustain 99.5%+ availability during primary store failover.

Workload Profile

Baseline Auth Traffic22,000 JWKS & Introspect Read RPS / 2,800 Token Exchange Write RPS
Morning SSO Login Surge58,000 Read RPS / 7,500 Write RPS
Active Working Set10 GB short-lived PKCE auth codes & active refresh grants
Security InvariantStrict single-use auth_code consumption + JWKS edge caching

Consistency Model

Read-after-write on single-use auth_code redemption and refresh-token rotation so a redeemed code cannot be replayed.

Relevant practice for

Click an item in Inventory above, or press B to add a component, double-click to name, C to connect.

Design Write-up

Write under ### Architecture for Diagram to take that up directly

Compulsory section · if not written yet, Diagram reads from the start of your write-up.
Architecture: required·FRs mentioned: 0/4·0 boxes · 0 edges
0 words
Hidden Cases #4–#7 run automatically on Submit
Case 1: Smoke & API ContractInput Workload
Read RPS
2,000 rps
Write RPS
280 rps
Key Distribution
Uniform (Low Skew)
Chaos Fault
None (Healthy Cluster)
Expected Pass CriteriaASSERTIONS
• Tail Latency: p99 ≤ 64 ms
• Availability: ≥ 99.5%
Valid end-to-end Client → Compute → Storage topology