Trait iron_csrf::CsrfProtection
[−]
[src]
pub trait CsrfProtection: Sized + Send + Sync { fn parse_token(&self, bytes: &[u8]) -> Result<CsrfTokenTransport, CsrfError>; fn parse_cookie(&self,
bytes: &[u8])
-> Result<CsrfCookieTransport, CsrfError>; fn generate_token_pair(&self,
previous_token: Option<Vec<u8>>,
ttl_seconds: i64)
-> Result<(CsrfToken, CsrfCookie), CsrfError>; fn verify_token_pair(&self,
token: &CsrfTokenTransport,
cookie: &CsrfCookieTransport)
-> bool { ... } }
Base trait that allows an iron
application to be wrapped with CSRF protection.
Required Methods
fn parse_token(&self, bytes: &[u8]) -> Result<CsrfTokenTransport, CsrfError>
Returns the internal representation of a CSRF token given a slice of decoded bytes.
Returns the internal representation of a CSRF cookie given a slice of decoded bytes.
fn generate_token_pair(&self,
previous_token: Option<Vec<u8>>,
ttl_seconds: i64)
-> Result<(CsrfToken, CsrfCookie), CsrfError>
previous_token: Option<Vec<u8>>,
ttl_seconds: i64)
-> Result<(CsrfToken, CsrfCookie), CsrfError>
Creates a CSRF token and cookie with the given TTL in seconds.
Provided Methods
fn verify_token_pair(&self,
token: &CsrfTokenTransport,
cookie: &CsrfCookieTransport)
-> bool
token: &CsrfTokenTransport,
cookie: &CsrfCookieTransport)
-> bool
Returns whether
Implementors
impl CsrfProtection for ChaCha20Poly1305CsrfProtection