What it means
A session lets a service connect a sequence of requests to shared state. After authentication, a session commonly lets the user continue without presenting their authenticator on every request. A browser may hold a session identifier in a cookie while the server stores the associated state, though implementations vary. The identifier must be treated as sensitive access material.
Session management covers creation, renewal, expiration, and invalidation. Authentication answers how the session was established; authorization still determines what each request can do. A stolen active session can sometimes be used without repeating the original sign-in, so strong authentication does not remove the need for session protection.
See the idea / Identity
The service decides whether a session is valid.
Compare the same case request before and at server-side session expiry. Session validity and case permission are separate checks.
Fictional CaseDesk. Prior authentication at 14:00 UTC created session SS61 for U52, with an exclusive 14:30 absolute expiry. Case C52 belongs to U52; policy permits own-case reads. Two independent request times, working HTTPS, and valid syntax are assumed.
01 / 04
Context
The same browser still holds the cookie for SS61 at 14:29 UTC. It asks CaseDesk to read C52. The service, not the cookie’s presence, decides whether this session remains valid.
More about this step
Completed authentication at 14:00 UTC created a fresh unpredictable opaque identifier in a Secure, HttpOnly, SameSite=Lax host-only cookie. SS61 is its safe record reference. The server maps it to U52 and enforces an exclusive 14:30 absolute expiry. These are independent test requests, not playback advancing a real clock. C52 belongs to U52; the policy permits own-case reads. The chosen lifetime is illustrative.
Step through at your own pace.
Keep in mindSS61 is a record reference, not a usable cookie value. This shows one server-side absolute expiry, not every session format, lifetime, logout, revocation, or fresh sign-in flow.
Read the visual, step by step
Before expiry · 14:29
- Context. The same browser still holds the cookie for SS61 at 14:29 UTC. It asks CaseDesk to read C52. The service, not the cookie’s presence, decides whether this session remains valid. Completed authentication at 14:00 UTC created a fresh unpredictable opaque identifier in a Secure, HttpOnly, SameSite=Lax host-only cookie. SS61 is its safe record reference. The server maps it to U52 and enforces an exclusive 14:30 absolute expiry. These are independent test requests, not playback advancing a real clock. C52 belongs to U52; the policy permits own-case reads. The chosen lifetime is illustrative.
- Request. The browser sends the request and its session cookie over HTTPS. CaseDesk shows receipt after arrival. The browser has received neither case content nor a sign-in response yet. The cookie accompanies the protected request; it is not a new login or separate actor. A browser may retain a cookie after server-side expiry. Holding it does not establish service acceptance. The synthetic figure sends no real request or credential.
- Check. CaseDesk checks SS61 against its own session record: it is valid before 14:30 UTC and maps to U52. The separate own-case policy allows reading C52; the response is still at the service. A session lookup associates the protected identifier with U52 and verifies its current server-side validity. The service also checks C52’s owner and current read permission. These are separate checks: a valid session would not authorize another account’s private case. No password or authenticator is submitted in this request. Both tests concern an unchanged account and case; only their evaluated time differs.
- Response. The allowed response returns a C52 copy to the browser. Its result appears after arrival. CaseDesk retains the original; the session connects this request to U52 without repeating the earlier authentication. The returned case copy arrives only after the response travels to the browser. This confirms one permitted read under the snapshot assumptions, not every action or a business-task completion. Protecting and invalidating session credentials remains necessary even with strong earlier authentication; a stolen accepted bearer-style session can be replayed without the original authenticator.
At expiry · 14:30
- Context. The same browser still holds the cookie for SS61 at 14:30 UTC. It asks CaseDesk to read C52. The service, not the cookie’s presence, decides whether this session remains valid. Completed authentication at 14:00 UTC created a fresh unpredictable opaque identifier in a Secure, HttpOnly, SameSite=Lax host-only cookie. SS61 is its safe record reference. The server maps it to U52 and enforces an exclusive 14:30 absolute expiry. These are independent test requests, not playback advancing a real clock. C52 belongs to U52; the policy permits own-case reads. The chosen lifetime is illustrative.
- Request. The browser sends the request and its session cookie over HTTPS. CaseDesk shows receipt after arrival. The browser has received neither case content nor a sign-in response yet. The cookie accompanies the protected request; it is not a new login or separate actor. A browser may retain a cookie after server-side expiry. Holding it does not establish service acceptance. The synthetic figure sends no real request or credential.
- Check. CaseDesk enforces the 14:30 UTC expiry. SS61 is now expired, so the service cannot use its old authenticated context and does not reach the case-permission check. At exactly 14:30 UTC the service rejects the old session under its own absolute-expiry policy. It does not treat the still-present cookie as a new authentication, and does not authorize or release C52. This refusal leaves the assumed working HTTPS transport, valid request syntax, account existence, and original case intact. Client-side cookie deletion is not the enforcement mechanism.
- Response. The sign-in-required response returns to the browser. After arrival, it sees that C52 was not delivered. The old cookie remains held; a fresh authentication and session would be a separate process. The response here is an authored sign-in prompt rather than case data; no particular HTTP status, redirect, or automatic reauthentication sequence is specified. It does not establish that every application session was revoked, the cookie disappeared, or an account was disabled. A replacement authenticated session would require its own completed flow.
SS61 is a record reference, not a usable cookie value. This shows one server-side absolute expiry, not every session format, lifetime, logout, revocation, or fresh sign-in flow.
Flow references: OWASP - server-side session validity and cookie protection · OWASP - per-request application permission
AN ILLUSTRATIVE SCENARIO
A council staff laptop
A council employee reports a lost laptop that may still have an active session in a case-management application. The response team disables the affected access as appropriate and separately revokes application sessions using the service's supported mechanism. It does not assume that changing the password or closing a browser elsewhere immediately ends every session. With a test account, the administrator verifies that the old session can no longer retrieve a synthetic case record.
Put it to work
- Use the framework's maintained session facilities; protect browser cookies with suitable Secure, HttpOnly, and SameSite settings for the application's behavior.
- Define inactivity and overall lifetimes based on risk, renew session identifiers after authentication or privilege changes, and provide server-side invalidation.
- Test logout, expiry, account disablement, and incident-driven revocation across the relevant applications; avoid putting live session values in URLs or logs.
How to check your work
Save a test session, revoke it through the intended mechanism, and try a protected request again. The service should reject it according to the documented policy, with useful evidence that avoids exposing the session secret.
Connect the ideas
- Authentication
The act of verifying a claimed identity with authenticators such as passwords, passkeys, or certificates.
- Authorization
The decision about whether a person, device, workload, or anonymous requester may perform a particular action on a resource.
- SSO
A pattern where one authentication to an identity provider is reused across multiple applications.
- Account recovery
The process for restoring account access when required authenticators are unavailable, using an approved recovery method.