Skip to content

From Sign-In to Every Request

Run the From Sign-In to Every Request MicroSim Fullscreen

About This MicroSim

This MicroSim follows one member from typing a password to every request that comes after it. The flowchart has eleven steps. Click any step to read what it does in the panel on the right. Yellow boxes are the three checks: the password check, the session lookup and the authorization check. Red boxes are the two ways a request is refused. A 401 means the server doesn't know who is asking. A 403 or 404 means it knows, and the answer is no.

The password travels once. After that, a cookie holding a random session ID stands in for the member. The cookie in the chapter's worked example lasts eight hours (Max-Age=28800) and is marked HttpOnly, Secure and SameSite. Maya, the member in the questions, is illustrative.

How to Use

  1. Click each step from 1 to 11 and read its text.
  2. Follow the two arrows into step 10 (wrong password, and a missing or expired session) and the one arrow into step 11.
  3. Answer the four questions on the right. Each allows one answer. The correct answer is shown after each one, and the count "n of 4" appears at the end.

Iframe Embed Code

You can add this MicroSim to any web page by adding this to your HTML:

<iframe src="https://arunbatchu.github.io/good-enough-engineering/sims/sign-in-to-every-request/main.html"
        height="810px"
        width="100%"
        scrolling="no"></iframe>

Lesson Plan

Learning Objective

The learner will explain how a session ID created at sign-in travels in a cookie and lets the server identify the member on each later request, and where authorization happens in that path.

Grade Level

Adult professional (Good Enough Engineering)

Duration

10-15 minutes

Prerequisites

Authentication, identity, authorization, session, cookie, HttpOnly, Secure and status code 401, from the chapter sections before the flowchart.

Activities

  1. Exploration (5 min): Click all eleven steps in order and say out loud what each one does.
  2. Guided Practice (5 min): Trace the three paths that end in a refusal. For each, name the check that fails.
  3. Assessment (5 min): Answer the four questions. Mastery is 4 of 4.

Assessment

  • Says that the browser sends the session ID in a cookie, not the password, on each request.
  • Says that an expired session gives a 401, not a 403.
  • Names the authorization check, not the session lookup, as the step that refuses another member's scan.
  • Explains that HttpOnly keeps the session ID away from scripts in the page.

References

  1. MDN: Using HTTP cookies - what Set-Cookie, HttpOnly, Secure and SameSite do.
  2. OWASP Session Management Cheat Sheet - how to create, store and expire session IDs safely.
  3. Mermaid flowchart syntax - the library that draws the diagram.