Skip to main content

aurelin_framework/
session.rs

1use tower_sessions::{
2    Expiry, SessionManagerLayer, SessionStore,
3    cookie::{SameSite, time::Duration},
4};
5
6pub fn web_session_layer<Store>(store: Store, cookie_name: &'static str, secure: bool) -> SessionManagerLayer<Store>
7where
8    Store: SessionStore,
9{
10    SessionManagerLayer::new(store)
11        .with_name(cookie_name)
12        .with_secure(secure)
13        .with_same_site(SameSite::Lax)
14        .with_expiry(Expiry::OnInactivity(Duration::minutes(120)))
15}