Expand description
What a request by session carries: the cookie, the CSRF token and the origin it must come from.
A session is a row in the registry (crate::tenants), found by the
SHA-256 of a random 256-bit id. The id travels in the cookie
COOKIE and nowhere else. The CSRF token is made from the id
(csrf_token), so GET /session can hand it to the page again while
the registry keeps only its hash; page script cannot read the cookie,
and the token does not show the id.
Structs§
- Origin
- A listener’s public origin (
public_origin,operator.public_origin):https://and a host, with a port when it is not 443, as a browser writes it in theOriginheader of a request from the listener’s pages.
Constants§
- COOKIE
- The session cookie’s name. The
__Host-prefix has a browser refuse the cookie unless it isSecure, hasPath=/and names no domain, so no other host and no plain-HTTP page can set or read it. - CSRF_
HEADER - The request header that carries the session’s CSRF token.
Functions§
- set_
cookie - The
Set-Cookievalue that gives a browser the session with this id. It names no lifetime: the browser drops it when it closes, and the registry holds the limits. A sign-in method answers with it onceTenants::start_sessionhas given it the id; none is built yet.