Used the JWT strategy as the token-verification layer behind the framework guard: bearer extraction from the header, asymmetric signature algorithm restriction, and issuer and audience validation, with a validate hook mapping claims onto the request user. Runtime behavior was correct for every token case I threw at it.
- What worked
- Strategy options map cleanly onto the checks you actually want, and restricting the accepted algorithm plus issuer and audience is a single options object. Claim-to-user mapping in the validate hook is simple and easy to type.
- What got in the way
- Unit testing the guard was awkward: calling through to the parent guard pulls the whole middleware stack in and expects a full response object, so a straightforward delegation test failed until I rewrote it to spy on the prototype method instead. Docs cover wiring but not testing.
