pub struct SessionLookup {
pub session: SessionRecord,
pub family: SessionFamilyRecord,
pub refresh: SessionRefreshRecord,
}Expand description
Combined repository lookup result used when locating session state by a refresh token hash.
§Examples
use std::time::{Duration, SystemTime};
use webgates_sessions::session::{
Session, SessionFamilyId, SessionFamilyRecord, SessionLookup, SessionRefreshRecord,
};
let now = SystemTime::UNIX_EPOCH + Duration::from_secs(1_000);
let family = SessionFamilyRecord::new(SessionFamilyId::new(), "user-42", now);
let session = Session::new(
family.family_id,
"user-42",
now,
now + Duration::from_secs(3_600),
);
let refresh = SessionRefreshRecord::new(
session.session_id,
family.family_id,
now + Duration::from_secs(3_600),
);
let lookup = SessionLookup::new(session, family, refresh);
assert!(lookup.is_active_at(now));Fields§
§session: SessionRecordSession matched by the lookup.
family: SessionFamilyRecordSession family that owns the matched session.
refresh: SessionRefreshRecordCurrent refresh-token record for the matched session.
Implementations§
Source§impl SessionLookup
impl SessionLookup
Sourcepub fn new(
session: SessionRecord,
family: SessionFamilyRecord,
refresh: SessionRefreshRecord,
) -> Self
pub fn new( session: SessionRecord, family: SessionFamilyRecord, refresh: SessionRefreshRecord, ) -> Self
Creates a new combined session lookup result.
Sourcepub fn is_active_at(&self, now: SystemTime) -> bool
pub fn is_active_at(&self, now: SystemTime) -> bool
Returns true when all looked-up state is currently active at now.
Trait Implementations§
Source§impl Clone for SessionLookup
impl Clone for SessionLookup
Source§fn clone(&self) -> SessionLookup
fn clone(&self) -> SessionLookup
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SessionLookup
impl Debug for SessionLookup
Source§impl PartialEq for SessionLookup
impl PartialEq for SessionLookup
Source§fn eq(&self, other: &SessionLookup) -> bool
fn eq(&self, other: &SessionLookup) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for SessionLookup
impl StructuralPartialEq for SessionLookup
Auto Trait Implementations§
impl Freeze for SessionLookup
impl RefUnwindSafe for SessionLookup
impl Send for SessionLookup
impl Sync for SessionLookup
impl Unpin for SessionLookup
impl UnsafeUnpin for SessionLookup
impl UnwindSafe for SessionLookup
Blanket Implementations§
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
Mutably borrows from an owned value. Read more