pub trait CsrfTokenManager: Send + Sync {
// Required methods
fn get_token(&self, token_id: &str) -> Result<CsrfToken, SecurityError>;
fn is_token_valid(&self, token: &CsrfToken) -> bool;
}Expand description
Issues and validates CSRF tokens.
Required Methods§
Sourcefn get_token(&self, token_id: &str) -> Result<CsrfToken, SecurityError>
fn get_token(&self, token_id: &str) -> Result<CsrfToken, SecurityError>
Creates a new token for token_id (usually the form name).
§Errors
Returns SecurityError::CsrfGeneration when the RNG fails.
Sourcefn is_token_valid(&self, token: &CsrfToken) -> bool
fn is_token_valid(&self, token: &CsrfToken) -> bool
Returns whether token matches a previously issued value for its id.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".