pub trait IAuthenticationHandler: Send + Sync {
// Required method
fn authenticate<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 mut dyn IHttpContext,
) -> Pin<Box<dyn Future<Output = Result<Option<Box<dyn IClaims>>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
}Expand description
Authentication scheme interface.
Implementations read credentials from the HTTP context (e.g., JWT bearer token,
API key header, cookie) and return claims or None if unauthenticated.
Required Methods§
Sourcefn authenticate<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 mut dyn IHttpContext,
) -> Pin<Box<dyn Future<Output = Result<Option<Box<dyn IClaims>>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: '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>>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Authenticate the request and return claims, or None if not authenticated.
Uses &mut dyn IHttpContext so the returned future is Send
(required by tokio::spawn — &dyn IHttpContext is !Send
because IHttpContext is not Sync).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".