Skip to main content

ensure_double_submit_token_with_names

Function ensure_double_submit_token_with_names 

Source
pub fn ensure_double_submit_token_with_names(
    req: &HttpRequest,
    names: &CsrfTokenNames,
) -> Result<()>
Expand description

Ensures an Actix request contains matching CSRF cookie and header values using custom names.

The helper only performs the double-submit comparison. Product middleware should decide when to call it, usually for unsafe methods authenticated by cookies. Pair it with request-source validation to reject cross-site writes before checking the token value.