Your Cart
Loading

Build a Multi-Tenant OIDC Resource Server That Denies by Default (TypeScript, jose, Hono): a Localpane Lab Kit

On Sale
$29.00
$29.00
Added to cart

Build an API that keeps two companies' data strictly apart, one tested step at a time. You write the security decisions around the jose library. That means refusing malformed and algorithm-confusion tokens, checking issuer, audience, expiry and key rotation, taking tenant and roles from the token alone, and a deny-by-default policy point with tenant boundary, roles, attributes and machine principals. You also write the route enforcement where a foreign object answers exactly like a missing one, lists and cursors that cannot leak, and a hash-chained audit log with revocation. Every step has a starter, tests that fail until your code works, plain explanations and hints. No Docker needed. The solution is included.


What's inside

  • WORKBOOK.md: 8 steps, each with the goal, key concepts in plain words, where the starter code is, the tests that must pass, hints and a check command
  • 8 starter projects (steps/step-01 to step-08): earlier steps solved, the current one stubbed, and every stub fails closed
  • The finished solution: about 1,300 lines of TypeScript (of which you write about 150, the security-critical parts) and 800 lines of tests
  • 61 graded adversarial tests, and 10 tests for the code the kit provides
  • A TEST-ONLY mock issuer that mints valid and deliberately broken tokens in memory: no Docker
  • check.sh to check one step and everything before it
  • curl commands to try the finished server locally
  • An optional, ungraded section on pointing the server at a real OpenID Connect provider

The 8 steps:

  1. Refuse before you verify: token shape and header
  2. Signature and claims against the issuer's keys
  3. The principal comes from the token alone
  4. Deny by default: the tenant boundary, then roles
  5. Attributes and machine principals
  6. Enforce it on every route: 401, 403 and 404
  7. Lists, counts, search and cursors that cannot leak
  8. Evidence: a hash-chained audit, traces, revocation


Who it's for

Backend developers who protect APIs with OAuth/OIDC access tokens and want to understand, by building it, what a resource server must check and where multi-tenant data leaks happen. It also suits engineers moving towards application security, and anyone preparing for security-focused design reviews or interviews.

Not for: anyone looking for a ready-made, certified security product or an identity provider. This kit does not implement login, sessions or JWT cryptography; it uses jose for the cryptography and a TEST-ONLY mock issuer for tokens.


Prerequisites

  • Node.js 24 or later; tested with Node 24.14.0 on macOS (Apple Silicon). Linux and Windows not yet tested.
  • Comfortable with TypeScript and async/await; basic HTTP (headers, status codes)
  • No prior OIDC or JWT knowledge needed
  • About 7 to 9 hours


Licence

Single-developer licence: use and modify the code, including in your own products; no redistribution and no public repositories. Free updates within 1.x.


Licence summary: payhip.com/u1791141470733132530294/licences

You will get a ZIP (482KB) file