Skip to content
Ameen Abozaid
Planned lessonJNR-038-L04

Validating tokens correctly

  • Lesson 4 of 7
  • Junior
On This Lesson 4 topics

This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.

In this lesson

list every check a server must make on a token.

Planned topics

  • Verify the signature with the expected key and the expected algorithm; never trust the token's own alg, and reject alg: none.
  • Check iss equals your issuer and aud includes your API.
  • Check exp (and nbf if used), allowing only a tiny clock skew.
  • Use a well-tested library (Spring's resource server uses Nimbus); never hand-write validation.
  • Keep signing keys secret (shared secret) or the private key private (asymmetric).
Draft outline details

Demonstration

a checklist: signature, algorithm, issuer, audience, expiry, then roles.

Check your understanding

Why reject alg: none?

Show answer

It means "unsigned", so anyone could forge a token.

Practice

Apply this lesson with the module's lab, exercises and quiz.

Lab and exercises Quiz

Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.

Continue to next lesson

Type to search levels, phases, modules and lessons.