Skip to main content

Crate actix_csrf_middleware

Crate actix_csrf_middleware 

Source

Structs§

CsrfDoubleSubmitCookie
Cookie flags for Double-Submit Cookie tokens.
CsrfMiddleware
Actix Web middleware providing CSRF protection.
CsrfMiddlewareConfig
Configuration for CsrfMiddleware.
CsrfMiddlewareService
CsrfResponse
CsrfToken
Extractor for the current CSRF token.

Enums§

CsrfError
Reason a request was rejected by CsrfMiddleware.
CsrfPattern
CSRF defense patterns for CsrfMiddleware.
CsrfTokenValidator
TokenClass
Classification of CSRF tokens by context.

Constants§

CSRF_PRE_SESSION_KEY
Pre-session cookie minted for unauthenticated flows.
DEFAULT_CSRF_ANON_TOKEN_KEY
Default cookie name for anonymous (pre-session) tokens, Double-Submit Cookie pattern.
DEFAULT_CSRF_TOKEN_FIELD
Default body field for the CSRF token when no header is present.
DEFAULT_CSRF_TOKEN_HEADER
Default header carrying the CSRF token.
DEFAULT_CSRF_TOKEN_KEY
Default name of the authorized CSRF token bucket.
DEFAULT_SESSION_ID_KEY
Default session id cookie; binds tokens and signals authorization state.

Traits§

CsrfRequestExt
Rotate or tear down CSRF state in a response, as an extension on HttpRequest.

Functions§

eq_tokens
Constant-time equality for token byte slices.
generate_hmac_token_ctx
Generates an HMAC-protected CSRF token bound to a context and identifier.
generate_random_token
Generates a cryptographically secure random CSRF token.
rotate_csrf_after_login
Upgrade anonymous CSRF state to authorized and write the cookie updates to resp.
rotate_csrf_after_logout
Tear down authorized CSRF state and write the cookie updates to resp.
validate_hmac_token
Validate an authorized-class CSRF token.
validate_hmac_token_ctx
Verifies an HMAC-protected CSRF token for a given class and identifier.