mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-23 23:51:06 +01:00
b1cea64795
Co-authored-by: Rob Ede <robjtede@icloud.com>
18 lines
449 B
Rust
18 lines
449 B
Rust
use actix_session::{storage::CookieSessionStore, SessionMiddleware};
|
|
use actix_web::cookie::Key;
|
|
use uuid::Uuid;
|
|
|
|
pub fn store() -> CookieSessionStore {
|
|
CookieSessionStore::default()
|
|
}
|
|
|
|
pub fn user_id() -> String {
|
|
Uuid::new_v4().to_string()
|
|
}
|
|
|
|
pub fn session_middleware() -> SessionMiddleware<CookieSessionStore> {
|
|
SessionMiddleware::builder(store(), Key::generate())
|
|
.cookie_domain(Some("localhost".into()))
|
|
.build()
|
|
}
|