pub struct AuthSessionManager { /* private fields */ }Expand description
Authentication session manager
Implementations§
Source§impl AuthSessionManager
impl AuthSessionManager
Sourcepub fn new(default_lifetime: Duration, max_sessions_per_user: usize) -> Self
pub fn new(default_lifetime: Duration, max_sessions_per_user: usize) -> Self
Create a new session manager
Sourcepub fn create_session(&self, provider: &str) -> AuthSession
pub fn create_session(&self, provider: &str) -> AuthSession
Create a new session
Sourcepub fn get_session(&self, id: &str) -> Option<AuthSession>
pub fn get_session(&self, id: &str) -> Option<AuthSession>
Get session by ID
Sourcepub fn get_session_by_state(&self, state: &str) -> Option<AuthSession>
pub fn get_session_by_state(&self, state: &str) -> Option<AuthSession>
Get session by OAuth2 state
Sourcepub fn update_session(&self, session: &AuthSession) -> Result<()>
pub fn update_session(&self, session: &AuthSession) -> Result<()>
Update session
Sourcepub fn remove_session(&self, id: &str) -> Option<AuthSession>
pub fn remove_session(&self, id: &str) -> Option<AuthSession>
Remove session
Sourcepub fn get_user_sessions(&self, email: &str) -> Vec<AuthSession>
pub fn get_user_sessions(&self, email: &str) -> Vec<AuthSession>
Get all sessions for a user (by email)
Sourcepub fn remove_user_sessions(&self, email: &str) -> usize
pub fn remove_user_sessions(&self, email: &str) -> usize
Remove all sessions for a user
Sourcepub fn cleanup_expired(&self) -> usize
pub fn cleanup_expired(&self) -> usize
Cleanup expired sessions
Sourcepub fn session_count(&self) -> usize
pub fn session_count(&self) -> usize
Get session count
Sourcepub fn active_sessions(&self) -> Vec<AuthSession>
pub fn active_sessions(&self) -> Vec<AuthSession>
Get all active sessions
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for AuthSessionManager
impl !RefUnwindSafe for AuthSessionManager
impl Send for AuthSessionManager
impl Sync for AuthSessionManager
impl Unpin for AuthSessionManager
impl UnwindSafe for AuthSessionManager
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