Hi 👋, I’m Anandharaj. Today’s Learnings : JWT Token Validation in Spring Security 🔹 Always Spring Security gives confusion to me. So I’m sharing my learnings on how a JWT token is validated when a request comes in. 🌍 What happens when a request comes in? 1️⃣ Incoming request with a token When a request hits your API, Spring Security’s filter chain intercepts it and extracts the token from the Authorization header (usually in the format: Bearer <token> ). 2️⃣ Check token type The filter checks if it’s a Bearer token and then hands it over to a configured JWT decoder . 🔎 JWT Structure A JWT has three parts , separated by dots ( . ): Header 👉 contains metadata (e.g., algorithm: HS256 , RS256 ) Payload 👉 contains claims (user info, expiry time, issuer, audience, etc.) Signature 👉 ensures integrity and authenticity 👉 Header and Payload are Base64URL‑encoded and readable. 👉 Signature is cryptographically generated and cannot be reverse‑engineered. 🛠...
A cozy space where I share my daily Java learnings, issues, and solutions.