pub struct JwtAuth { /* private fields */ }Expand description
JWT-based authentication handler.
Reads the Authorization: Bearer <token> header, decodes and validates
the JWT, and returns the resulting claims.
Implementations§
Source§impl JwtAuth
impl JwtAuth
Sourcepub fn new(decoding_key: DecodingKey, validation: Validation) -> Self
pub fn new(decoding_key: DecodingKey, validation: Validation) -> Self
Create a new JWT authenticator.
Trait Implementations§
Source§impl IAuthenticationHandler for JwtAuth
impl IAuthenticationHandler for JwtAuth
Source§fn authenticate<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 mut dyn IHttpContext,
) -> Pin<Box<dyn Future<Output = Result<Option<Box<dyn IClaims>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn authenticate<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 mut dyn IHttpContext,
) -> Pin<Box<dyn Future<Output = Result<Option<Box<dyn IClaims>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Authenticate the request and return claims, or
None if not authenticated. Read moreAuto Trait Implementations§
impl Freeze for JwtAuth
impl RefUnwindSafe for JwtAuth
impl Send for JwtAuth
impl Sync for JwtAuth
impl Unpin for JwtAuth
impl UnsafeUnpin for JwtAuth
impl UnwindSafe for JwtAuth
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