pub struct SessionData {
pub id: String,
pub user_id: String,
pub ip_address: String,
pub user_agent: String,
pub device_name: String,
pub device_type: String,
pub fingerprint: String,
pub data: Value,
pub created_at: DateTime<Utc>,
pub last_active_at: DateTime<Utc>,
pub expires_at: DateTime<Utc>,
}Expand description
Transport-agnostic snapshot of one authenticated session.
Populated into request extensions by
CookieSessionLayer (cookie transport)
or JwtLayer (JWT transport). Handlers extract it
the same way regardless of which transport authenticated the request:
use modo::auth::session::Session;
async fn me(session: Session) -> String {
session.user_id
}The extractor returns 401 auth:session_not_found when no row is loaded.
Use Option<Session> for routes that serve both authenticated and
unauthenticated callers.
Session is read-only — to mutate session data use
CookieSession (cookie transport) or
JwtSession (JWT transport).
Fields§
§id: StringSession ULID — unique stable identifier for this row.
user_id: StringAuthenticated user identifier.
ip_address: StringClient IP address recorded at login.
user_agent: StringRaw User-Agent header recorded at login.
device_name: StringHuman-readable device name derived from the user agent
(e.g. "Chrome on macOS").
device_type: StringDevice category — "desktop", "mobile", or "tablet".
fingerprint: StringSHA-256 fingerprint of the browser environment, used to detect session hijacking.
data: ValueArbitrary JSON data attached to the session by the application.
created_at: DateTime<Utc>Timestamp of session creation.
last_active_at: DateTime<Utc>Timestamp of the most recent activity (updated on touch).
expires_at: DateTime<Utc>Timestamp at which the session expires.