Umbral
Back to plugin directory
US

Umbral Sessions

Official by Umbral contributors

signed cookies, DB/Redis stores, lazy session data

official stable

About

HTTP forgets you the moment the response is sent. Sessions are how your app remembers — the signed-in user, a half-filled cart, a flash message that should survive one redirect. Umbral Sessions gives you a server-side store (persisted through the ORM, so no extra infrastructure to stand up) plus the cookie middleware that ties each browser to its row, with secure defaults already switched on.

Install

cargo add umbral-sessions

Wire it up

Add it before anything that reads the session — auth, in particular.

use umbral::prelude::*;
use umbral_sessions::SessionsPlugin;

let app = App::builder()
    .database("default", pool)
    .plugin(SessionsPlugin::default())
    .plugin(AuthPlugin::<AuthUser>::default())  // reads the session
    .build()?;

Target: stash something across requests

The session is a typed key/value bag that outlives a single request.

use umbral_sessions::Session;

async fn add_to_cart(session: Session) {
    let mut cart: Vec<i64> = session.get("cart").await.unwrap_or_default();
    cart.push(product_id);
    session.insert("cart", &cart).await;
}

What you get

  • DB-backed session store — no Redis required to start
  • Cookie middleware with secure, HttpOnly defaults
  • The foundation umbral-auth's login / logout builds on
  • Redis-backed store on the roadmap for horizontal scaling

Usage

Register `SessionsPlugin` before any plugin that reads the session (auth reads it on every request). The default store persists sessions through the ORM, so there's nothing extra to deploy.

plugin setup
cargo add umbral-sessions

Feature tracker

Per-feature shipping status, recorded in the directory.

8 of 8 shipped
DB-backed session store shipped Stable

Server-side sessions persisted through the ORM.

Cookie session store shipped Stable

Signed cookie store for lightweight deployments.

Session middleware shipped Stable

Cookie handling with secure defaults.

Login / logout flow shipped Stable

Establish and tear down the authenticated session.

Redis-backed sessions usable Beta

Shared session store for horizontal scaling.

Lazy session writes shipped Stable

Read without creating rows; persist only when data changes.

Sliding expiry shipped Beta

Optional renewal window plus max-session-age enforcement.

Revocation and cleanup shipped Beta

User-session revocation and expired-session cleanup command.

Compatibility

Declared support per Umbral version and database backend.

No compatibility rows declared yet.

Community notes

0 notes in the discussion thread.

No notes yet. Be the first to share how this plugin works for you.

Reported issues

Bugs and abuse reports filed against this plugin.

Report an issue

No open issues

No issues have been reported against this plugin. Track upstream bugs on the maintainer's tracker, or report a directory problem to the Umbral team.