pub struct Sessions { /* private fields */ }Expand description
How long a panel’s sessions last, set by Auth::sessions: seven days from sign-in by
default, however long the user stays away meanwhile.
// A back office: sign in again each working day, and after half an hour away.
let auth = Auth::password().sessions(
Sessions::new()
.lifetime(Duration::from_secs(10 * 60 * 60))
.idle_timeout(Duration::from_secs(30 * 60)),
);Implementations§
Source§impl Sessions
impl Sessions
Sourcepub fn new() -> Self
pub fn new() -> Self
Sessions that last SESSION_LIFETIME from sign-in, with no idle timeout.
Sourcepub fn lifetime(self, lifetime: Duration) -> Self
pub fn lifetime(self, lifetime: Duration) -> Self
How long a session lasts from the sign-in that started it, whatever the user does meanwhile; never under a minute.
It holds for the sessions already open: one older than a shortened lifetime ends on its next request. A credential change starts the lifetime again, with the session it issues.
Sourcepub fn idle_timeout(self, idle: Duration) -> Self
pub fn idle_timeout(self, idle: Duration) -> Self
Ends a session once idle passes without a request from it, before its
lifetime does; never under a minute. Off by default.
Each request the panel’s gate admits counts, a background one included; an open page that
sends none, such as one showing the notification bell, does not. The session row records
the end, moved forward at most once per tenth of idle, capped at five minutes, so a
session may end that much early. A session opened before the timeout was set ends idle
after its next request.
Trait Implementations§
impl Copy for Sessions
impl Eq for Sessions
impl StructuralPartialEq for Sessions
Auto Trait Implementations§
impl Freeze for Sessions
impl RefUnwindSafe for Sessions
impl Send for Sessions
impl Sync for Sessions
impl Unpin for Sessions
impl UnsafeUnpin for Sessions
impl UnwindSafe for Sessions
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.