Spring Security is a servlet filter chain that intercepts every request before it reaches your controller. Authentication answers "who are you?"; authorization answers "are you allowed to do this?". For stateless REST APIs, the common approach is JWT (JSON Web Token) instead of server-side sessions.
The JWT flow
POST /login (user+pass) ──▶ AuthController verifies ──▶ signs JWT ──▶ returns token
│
Client stores it, then sends on every call: ▼
GET /api/orders Authorization: Bearer <jwt> ──▶ JwtFilter validates ──▶ controller
