Introduction
When you log into a website or app, it needs to remember who you are while you use it. Without a safe way to keep this memory, someone else could pretend to be you and cause trouble.
Imagine you enter a concert with a wristband that lets you move around inside. If someone else copies your wristband or keeps it after you leave, they could sneak in pretending to be you. The concert staff changes wristbands often and checks them carefully to keep everyone safe.
┌─────────────────────────────┐
│ User Logs In │
└─────────────┬───────────────┘
│
Session ID Created
│
┌─────────────▼───────────────┐
│ Session ID Stored Securely │
│ (Cookie or Server Memory) │
└─────────────┬───────────────┘
│
Session ID Sent Over
Encrypted Link
│
┌─────────────▼───────────────┐
│ Session ID Used to Verify │
│ User Requests │
└─────────────┬───────────────┘
│
Session ID Renewed
and Expired Properly
│
┌─────────────▼───────────────┐
│ Protection Against Attacks │
│ (HttpOnly, Secure Flags) │
└─────────────────────────────┘