Skip to main content

CsrfExt

Trait CsrfExt 

Source
pub trait CsrfExt {
    // Required methods
    fn csrf_token(&self) -> String;
    fn verify_csrf(&self, submitted: Option<&str>) -> Result<()>;
}
Expand description

Request helpers for CSRF tokens.

Required Methods§

Source

fn csrf_token(&self) -> String

Session CSRF token (creates one if missing).

Source

fn verify_csrf(&self, submitted: Option<&str>) -> Result<()>

Compare submitted value to the session token.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl CsrfExt for Request

Source§

fn csrf_token(&self) -> String

Source§

fn verify_csrf(&self, submitted: Option<&str>) -> Result<()>

Implementors§