Struct salvo_csrf::Csrf
source · pub struct Csrf<C, S> { /* private fields */ }
Expand description
Cross-Site Request Forgery (CSRF) protection middleware.
Implementations§
source§impl<C: CsrfCipher, S: CsrfStore> Csrf<C, S>
impl<C: CsrfCipher, S: CsrfStore> Csrf<C, S>
sourcepub fn new(cipher: C, store: S, finder: impl CsrfTokenFinder) -> Self
pub fn new(cipher: C, store: S, finder: impl CsrfTokenFinder) -> Self
Create a new instance.
sourcepub fn add_finder(self, finder: impl CsrfTokenFinder) -> Self
pub fn add_finder(self, finder: impl CsrfTokenFinder) -> Self
Add finder to find csrf token.
Trait Implementations§
source§impl<C: CsrfCipher, S: CsrfStore> Handler for Csrf<C, S>
impl<C: CsrfCipher, S: CsrfStore> Handler for Csrf<C, S>
source§fn handle<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
req: &'life1 mut Request,
depot: &'life2 mut Depot,
res: &'life3 mut Response,
ctrl: &'life4 mut FlowCtrl,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn handle<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
req: &'life1 mut Request,
depot: &'life2 mut Depot,
res: &'life3 mut Response,
ctrl: &'life4 mut FlowCtrl,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Handle http request.
Auto Trait Implementations§
impl<C, S> Freeze for Csrf<C, S>
impl<C, S> !RefUnwindSafe for Csrf<C, S>
impl<C, S> Send for Csrf<C, S>
impl<C, S> Sync for Csrf<C, S>
impl<C, S> Unpin for Csrf<C, S>
impl<C, S> !UnwindSafe for Csrf<C, S>
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