1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//! Cookie-backed session persistence for `tower-sessions`.
//!
//! This crate provides a layer that inserts `tower_sessions_core::Session` into request
//! extensions and persists the session record into a cookie.
//!
//! # Security
//! The default format is a signed cookie (`signed` feature).
//!
//! The `dangerous-plaintext` feature enables a plaintext cookie controller. This offers **no tamper
//! resistance** and should only be used for **testing and debugging**. Never enable or use this in
//! a real application: a client can trivially edit the cookie to escalate privileges and
//! impersonate other users (including staff/admin).
//!
//! ## Example (Axum, signed cookies)
//!
//! ```rust
//! use axum::{routing::get, Router};
//! use tower_sessions_cookie_store::{CookieSessionConfig, CookieSessionManagerLayer, Key, Session};
//!
//! async fn handler(session: Session) -> String {
//! let n: usize = session.get("n").await.expect("session get succeeds").unwrap_or(0);
//! session.insert("n", n + 1).await.expect("session insert succeeds");
//! format!("n={n}")
//! }
//!
//! let key = Key::generate();
//! let config = CookieSessionConfig::default().with_secure(false);
//! let app = Router::<()>::new()
//! .route("/", get(handler))
//! .layer(CookieSessionManagerLayer::signed(key).with_config(config));
//! ```
compile_error!;
/// Tower layer for cookie-backed sessions.
pub use SameSite;
pub use ;
pub use Key;
pub use crateCookieSessionConfig;
pub use crateDEFAULT_COOKIE_NAME;
pub use crateCookieController;
pub use crate;
pub use crateCookieSessionManagerLayer;
pub use crateSignedCookie;
pub use cratePrivateCookie;
pub use crateDangerousPlaintextCookie;