Lion Cipher Lab

Build a token introspection and revocation service from scratch (RFC 7662 + RFC 7009)

Why it matters

Every OAuth 2.0 system has to answer two questions that sound trivial and are not: 'is this access token still good?' and 'how do I make a token stop working RIGHT NOW?' An access token is the credential a client sends your API to prove it's allowed in -- usually as an HTTP header `Authorization: Bearer <token>`. There are two families of token. A JWT (JSON Web Token) is SELF-CONTAINED: it carries its own signed claims, so any service can validate it OFFLINE with just the issuer's public key -- fast, no network call, and the subject of the sibling from-scratch-validator lab. The catch is…

What you'll learn

Steps in this lab

  1. The fork in the road: reference tokens vs JWTs (and why revocation is the whole reason)
  2. Stand up the authorization server and mint an opaque reference token
  3. Build the /introspect endpoint (RFC 7662) -- exact active:true shape, minimal active:false
  4. Wire a protected resource API that authorizes each request via /introspect
  5. Build the /revoke endpoint (RFC 7009) -- ALWAYS 200, even for tokens it's never seen
  6. Prove the whole lifecycle with curl: mint -> introspect -> use -> revoke -> introspect -> reject
  7. The caching / revocation-latency gap -- and see it with your own eyes
  8. The judgment: introspection vs local JWT validation -- when to choose each

Open the full interactive lab →