pub struct AuthMiddleware { /* private fields */ }Expand description
Token-based authentication middleware.
Implementations§
Source§impl AuthMiddleware
impl AuthMiddleware
Sourcepub fn new(token: impl Into<String>) -> AuthMiddleware
pub fn new(token: impl Into<String>) -> AuthMiddleware
Create a new auth middleware with the given token.
Trait Implementations§
Source§impl Middleware for AuthMiddleware
impl Middleware for AuthMiddleware
Source§fn process_request<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
request: &'life1 JsonRpcRequest,
ctx: &'life2 mut RequestContext,
) -> Pin<Box<dyn Future<Output = MiddlewareResult> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
AuthMiddleware: 'async_trait,
fn process_request<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
request: &'life1 JsonRpcRequest,
ctx: &'life2 mut RequestContext,
) -> Pin<Box<dyn Future<Output = MiddlewareResult> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
AuthMiddleware: 'async_trait,
Process an incoming request. Return
Continue or Reject.Source§fn process_response<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_response: &'life1 mut JsonRpcResponse,
_ctx: &'life2 RequestContext,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn process_response<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_response: &'life1 mut JsonRpcResponse,
_ctx: &'life2 RequestContext,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Optionally process the outgoing response (no-op by default).
Auto Trait Implementations§
impl Freeze for AuthMiddleware
impl RefUnwindSafe for AuthMiddleware
impl Send for AuthMiddleware
impl Sync for AuthMiddleware
impl Unpin for AuthMiddleware
impl UnsafeUnpin for AuthMiddleware
impl UnwindSafe for AuthMiddleware
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