Expand description
User session, admin authentication, and authentication traits.
Structs§
- Current
User - Authenticated user injected into request extensions.
Enums§
- Login
Error - Why
loginopened no session.
Functions§
- is_
authenticated - Checks if the user is authenticated.
- login
- Logs in a user: stores their id in the session (and renews the session id
and the CSRF token). Their name, rights and account state are read from the
database on each request (
request.user), not stored here. - logout
- Logs out a user — removes the memory session and the DB entry if provided. Does nothing when no one is logged in.
- protect_
session - Protects an anonymous session from cleanup.
- set_
auth_ session_ ttl_ secs - Called once at build time. Idempotent. A second call with a different value (two apps in the same process) is logged, never swallowed.
- unprotect_
session - Removes manual protection from an anonymous session.