Skip to main content

Module csrf

Module csrf 

Source
Expand description

Axum CSRF adapter with explicit product route, source and error boundaries.

Re-exports§

pub use crate::shared::csrf::CsrfError;
pub use crate::shared::csrf::CsrfErrorKind;
pub use crate::shared::csrf::CsrfTokenNames;
pub use crate::shared::csrf::RequestSourceMode;

Structs§

CsrfConfig
State for from_fn_with_state(config, csrf). Product predicates decide cookie authentication.
RequestSourcePolicy
Runtime source policy supplied by product configuration.

Functions§

csrf
Enforces source and double-submit checks on product-selected unsafe requests.
ensure_double_submit_token
Checks tokens using the default names.
ensure_double_submit_token_with_names
Checks decoded cookies and headers using the shared constant-time comparison.
ensure_request_source_allowed
Checks request source headers against explicit trusted scheme/host and public origins. Opaque non-UTF8 headers are invalid, including in optional mode.