pub struct SessionMiddleware<S, U>{ /* private fields */ }Expand description
Session authentication middleware (placeholder for Phase 5.4)
This will be implemented in Phase 5.4: User Authentication Middleware
Implementations§
Source§impl<S, U> SessionMiddleware<S, U>where
S: SessionStorage<SessionId = SessionId, SessionData = SessionData>,
U: Authenticatable + Clone,
impl<S, U> SessionMiddleware<S, U>where
S: SessionStorage<SessionId = SessionId, SessionData = SessionData>,
U: Authenticatable + Clone,
Sourcepub fn new(
provider: SessionProvider<S, U>,
config: SessionMiddlewareConfig,
) -> Self
pub fn new( provider: SessionProvider<S, U>, config: SessionMiddlewareConfig, ) -> Self
Create new session middleware
Sourcepub fn with_default_config(provider: SessionProvider<S, U>) -> Self
pub fn with_default_config(provider: SessionProvider<S, U>) -> Self
Create session middleware with default config
Extract session ID from cookie header string
Sourcepub fn should_skip_path(&self, path: &str) -> bool
pub fn should_skip_path(&self, path: &str) -> bool
Check if path should be skipped
Create session cookie string
Sourcepub async fn validate_session(
&self,
session_id: &SessionId,
) -> AuthResult<SessionData>
pub async fn validate_session( &self, session_id: &SessionId, ) -> AuthResult<SessionData>
Validate session and get session data
Sourcepub fn create_user_context(&self, session_data: &SessionData) -> UserContext
pub fn create_user_context(&self, session_data: &SessionData) -> UserContext
Create user context from session data
Sourcepub fn provider(&self) -> &SessionProvider<S, U>
pub fn provider(&self) -> &SessionProvider<S, U>
Get the session provider
Sourcepub fn config(&self) -> &SessionMiddlewareConfig
pub fn config(&self) -> &SessionMiddlewareConfig
Get the configuration
Auto Trait Implementations§
impl<S, U> Freeze for SessionMiddleware<S, U>
impl<S, U> RefUnwindSafe for SessionMiddleware<S, U>where
U: RefUnwindSafe,
S: RefUnwindSafe,
impl<S, U> Send for SessionMiddleware<S, U>
impl<S, U> Sync for SessionMiddleware<S, U>
impl<S, U> Unpin for SessionMiddleware<S, U>where
U: Unpin,
impl<S, U> UnsafeUnpin for SessionMiddleware<S, U>
impl<S, U> UnwindSafe for SessionMiddleware<S, U>where
S: RefUnwindSafe,
U: UnwindSafe,
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
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more