These secure demos show Rate limiting, Session fixation defenses, Reset tokens, MFA (TOTP-style), and Remember-me with selector/validator.
Uses shared DB tables (a07_*). Seed data in db/seed.sql.
Compare with the Insecure version.
Secure idea: Track attempts per user and IP in a sliding window, add backoff/jitter, and log for alerting. Responses remain uniform. "alice@example.com/alice@example.com"
Secure idea: on login, session_regenerate_id(true) to kill fixation.
Set cookies with HttpOnly, Secure, and SameSite=Lax/Strict.
Secure idea: 32-byte random token → store the hash with short TTL, single-use.
Secure idea: Require time-based one-time code from per-user secret, verify in small window, and track a one-time challenge nonce.
Secure idea: Split cookie into selector (id) + validator (secret). Store only the hash of the validator with expiry; rotate on use; mismatch ⇒ invalidate.