pub struct SessionGuard<U: Authenticatable> { /* private fields */ }Expand description
Authenticates from the request’s session.
Requires the StartSession middleware to
have run — without it there is no session, and this guard reports nobody
rather than pretending.
Implementations§
Source§impl<U: Authenticatable> SessionGuard<U>
impl<U: Authenticatable> SessionGuard<U>
Trait Implementations§
Source§impl<U: Authenticatable> Guard<U> for SessionGuard<U>
impl<U: Authenticatable> Guard<U> for SessionGuard<U>
Source§impl<U: Authenticatable> StatefulGuard<U> for SessionGuard<U>
impl<U: Authenticatable> StatefulGuard<U> for SessionGuard<U>
Source§fn attempt<'a>(
&'a self,
request: &'a Request,
credentials: &'a Credentials,
) -> BoxFuture<'a, Result<Option<U>>>
fn attempt<'a>( &'a self, request: &'a Request, credentials: &'a Credentials, ) -> BoxFuture<'a, Result<Option<U>>>
Verify credentials and, on success, log the user into this request’s
session. Returns the user, or
None if the credentials were wrong.Auto Trait Implementations§
impl<U> !RefUnwindSafe for SessionGuard<U>
impl<U> !UnwindSafe for SessionGuard<U>
impl<U> Freeze for SessionGuard<U>
impl<U> Send for SessionGuard<U>
impl<U> Sync for SessionGuard<U>
impl<U> Unpin for SessionGuard<U>
impl<U> UnsafeUnpin for SessionGuard<U>
Blanket Implementations§
impl<T> Actor 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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Event for T
impl<T> Event for T
Source§fn event_name() -> &'static strwhere
Self: Sized,
fn event_name() -> &'static strwhere
Self: Sized,
A human-readable name, used by wildcard listeners and log output.
Always the Rust type path; see the trait docs.
Source§impl<U, G> GuardExt<U> for G
impl<U, G> GuardExt<U> for G
Source§fn check<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 Request,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn check<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 Request,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Whether the request is authenticated.
Source§fn guest<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 Request,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn guest<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 Request,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Whether the request is not authenticated.