pub struct Authentication<User: Send + Sync + 'static, ImplScheme: Scheme<User>> { /* private fields */ }
Expand description
Middleware for implementing a given Scheme
(Basic, Bearer, Jwt) backed by a given
Storage
backend implemented by the Tide application
State
.
Implementations§
Source§impl<User: Send + Sync + 'static, ImplScheme: Scheme<User>> Authentication<User, ImplScheme>
impl<User: Send + Sync + 'static, ImplScheme: Scheme<User>> Authentication<User, ImplScheme>
Sourcepub fn new(scheme: ImplScheme) -> Self
pub fn new(scheme: ImplScheme) -> Self
Create a new authentication middleware with a scheme.
§Examples
#[derive(Clone)]
struct MyUserType {
username: String
}
use tide_http_auth::{ Authentication, BasicAuthScheme };
Authentication::<MyUserType, BasicAuthScheme>::new(BasicAuthScheme::default());
Trait Implementations§
Source§impl<ImplScheme, State, User> Middleware<State> for Authentication<User, ImplScheme>
impl<ImplScheme, State, User> Middleware<State> for Authentication<User, ImplScheme>
Source§fn handle<'life0, 'life1, 'async_trait>(
&'life0 self,
req: Request<State>,
next: Next<'life1, State>,
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle<'life0, 'life1, 'async_trait>(
&'life0 self,
req: Request<State>,
next: Next<'life1, State>,
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Asynchronously handle the request, and return a response.
Auto Trait Implementations§
impl<User, ImplScheme> Freeze for Authentication<User, ImplScheme>where
ImplScheme: Freeze,
impl<User, ImplScheme> RefUnwindSafe for Authentication<User, ImplScheme>where
ImplScheme: RefUnwindSafe,
User: RefUnwindSafe,
impl<User, ImplScheme> Send for Authentication<User, ImplScheme>where
ImplScheme: Send,
impl<User, ImplScheme> Sync for Authentication<User, ImplScheme>where
ImplScheme: Sync,
impl<User, ImplScheme> Unpin for Authentication<User, ImplScheme>
impl<User, ImplScheme> UnwindSafe for Authentication<User, ImplScheme>where
ImplScheme: UnwindSafe,
User: 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