Sicurezza Informatica REST API

Decoding JWT: The Theory Behind Security Guaranteed by Immutable Information

JWT explained from theory: cookies, sessions, token structure, digital signature, claims, and Bearer tokens for secure REST APIs.

Course description

JWT — Finally Understood, Not Just Used

Many developers use JWTs by copying code from Stack Overflow without really understanding what is happening. In this course, we start from the problem that JWTs solve — the mutability of client-side cookies — and work our way through the complete token structure, cryptographic signing, and the Bearer protocol. Pure theory, but exactly the theory you need to make informed security decisions.

What You'll Learn

  • Why cookies are modifiable by the client and what security risk that poses
  • How HTTP sessions work and why they don't scale in server clusters
  • The idea behind the token: self-contained, server-verifiable data
  • JWT structure: header, payload, and signature — how they are built
  • Base64 encoding and HMAC signing: what "immutable information" really means
  • The token verification process on the server side
  • Standard claims: iss, sub, exp, aud and how to use them
  • Where to store the token on the client and how to send it with Authorization Bearer

Who This Course Is For

Backend and full-stack developers who use JWTs in their APIs but want to truly understand what they are doing — not just calling a library, but making informed decisions about security, token expiration, and session management.

Why Theory Matters

Understanding JWT lets you correctly assess vulnerabilities (stolen tokens, the none algorithm, replay attacks) and choose the right strategy for your use case — stateless with JWT or stateful with sessions.

Lessons list

I'll start from the root problem: I'll explain why client-side cookies can be directly modified in the browser, what concrete security risk this creates for web applications, and why blindly trusting data sent from the client is a dangerous approach.

Guarda lezione

Let's see how HTTP sessions work on the server: the server maintains user state and the client receives only an identifier. I'll also explain why this approach, while secure, becomes a bottleneck in distributed systems with multiple servers running in parallel.

Guarda lezione

I'll explain the classic session problem in server clusters — session affinity and its limitations — and how the token idea was born precisely to solve it: a self-contained, verifiable object that requires no shared state across servers.

Guarda lezione

I'll break down the internal structure of a JWT together: the header (algorithm and type), the payload (the data), and the signature (the integrity guarantee). I'll show you how each part is Base64-encoded and how the HMAC signature makes the token tamper-proof without the secret key.

Guarda lezione

I'll walk you step by step through the process the server executes to verify a received JWT: how it recalculates the signature, compares the parts, and determines whether the token is authentic and unaltered. I'll also explain what claims are and why they are the heart of the payload.

Guarda lezione

I'll show you the standard JWT claims — iss (issuer), sub (subject), exp (expiration), aud (audience) — explaining how to use them concretely to manage token expiration, identify the user, and restrict access permissions in a REST API.

Guarda lezione

In this final lesson I'll explain where to store the JWT on the client (localStorage vs HttpOnly cookie), how to send it to the server in the Authorization header using the Bearer scheme, and what it truly means to have stateless authentication in a REST architecture.

Guarda lezione
Giovanni Pace

Giovanni Pace

Ingegnere Informatico · Pratola Peligna

  • 107 Courses
About the teacher

Sono un ingegnere informatico con oltre 15 anni di esperienza nel settore ICT. Mi occupo di sviluppo software, cybersecurity, data science e intelligenza artificiale, con particolare attenzione all’innovazione e all’automazione dei processi aziendali. Da anni svolgo anche attività di docenza e formazione, creando percorsi pratici e coinvolgenti su programmazione, DevOps, AI e sicurezza informatica.

This course includes

  • Lessons 7
  • Duration 0h 53m
  • Difficulty intermedio
  • Language it
  • Certificate No

Recently viewed