[−][src]Trait iron_csrf::csrf::CsrfProtection
The base trait that allows a developer to add CSRF protection to an application.
Required methods
fn generate_cookie(
&self,
token_value: &[u8; 64],
ttl_seconds: i64
) -> Result<CsrfCookie, CsrfError>
&self,
token_value: &[u8; 64],
ttl_seconds: i64
) -> Result<CsrfCookie, CsrfError>
Given a nonce and a time to live (TTL), create a cookie to send to the end user.
fn generate_token(&self, token_value: &[u8; 64]) -> Result<CsrfToken, CsrfError>
Given a nonce, create a token to send to the end user.
fn parse_cookie(
&self,
cookie: &[u8]
) -> Result<UnencryptedCsrfCookie, CsrfError>
&self,
cookie: &[u8]
) -> Result<UnencryptedCsrfCookie, CsrfError>
Given a decoded byte array, deserialize, decrypt, and verify the cookie.
fn parse_token(&self, token: &[u8]) -> Result<UnencryptedCsrfToken, CsrfError>
Given a decoded byte array, deserialize, decrypt, and verify the token.
Provided methods
fn verify_token_pair(
&self,
token: &UnencryptedCsrfToken,
cookie: &UnencryptedCsrfCookie
) -> bool
&self,
token: &UnencryptedCsrfToken,
cookie: &UnencryptedCsrfCookie
) -> bool
Given a token pair that has been parsed, decoded, decrypted, and verified, return whether or not the token matches the cookie and they have not expired.
fn random_bytes(&self, buf: &mut [u8]) -> Result<(), CsrfError>
Given a buffer, fill it with random bytes or error if this is not possible.
fn generate_token_pair(
&self,
previous_token_value: Option<&[u8; 64]>,
ttl_seconds: i64
) -> Result<(CsrfToken, CsrfCookie), CsrfError>
&self,
previous_token_value: Option<&[u8; 64]>,
ttl_seconds: i64
) -> Result<(CsrfToken, CsrfCookie), CsrfError>
Given an optional previous token and a TTL, generate a matching token and cookie pair.
Implementors
impl CsrfProtection for AesGcmCsrfProtection
[src]
fn generate_cookie(
&self,
token_value: &[u8; 64],
ttl_seconds: i64
) -> Result<CsrfCookie, CsrfError>
[src]
&self,
token_value: &[u8; 64],
ttl_seconds: i64
) -> Result<CsrfCookie, CsrfError>
fn generate_token(&self, token_value: &[u8; 64]) -> Result<CsrfToken, CsrfError>
[src]
fn parse_cookie(
&self,
cookie: &[u8]
) -> Result<UnencryptedCsrfCookie, CsrfError>
[src]
&self,
cookie: &[u8]
) -> Result<UnencryptedCsrfCookie, CsrfError>
fn parse_token(&self, token: &[u8]) -> Result<UnencryptedCsrfToken, CsrfError>
[src]
impl CsrfProtection for ChaCha20Poly1305CsrfProtection
[src]
fn generate_cookie(
&self,
token_value: &[u8; 64],
ttl_seconds: i64
) -> Result<CsrfCookie, CsrfError>
[src]
&self,
token_value: &[u8; 64],
ttl_seconds: i64
) -> Result<CsrfCookie, CsrfError>
fn generate_token(&self, token_value: &[u8; 64]) -> Result<CsrfToken, CsrfError>
[src]
fn parse_cookie(
&self,
cookie: &[u8]
) -> Result<UnencryptedCsrfCookie, CsrfError>
[src]
&self,
cookie: &[u8]
) -> Result<UnencryptedCsrfCookie, CsrfError>
fn parse_token(&self, token: &[u8]) -> Result<UnencryptedCsrfToken, CsrfError>
[src]
impl CsrfProtection for HmacCsrfProtection
[src]
fn generate_cookie(
&self,
token_value: &[u8; 64],
ttl_seconds: i64
) -> Result<CsrfCookie, CsrfError>
[src]
&self,
token_value: &[u8; 64],
ttl_seconds: i64
) -> Result<CsrfCookie, CsrfError>
fn generate_token(&self, token_value: &[u8; 64]) -> Result<CsrfToken, CsrfError>
[src]
fn parse_cookie(
&self,
cookie: &[u8]
) -> Result<UnencryptedCsrfCookie, CsrfError>
[src]
&self,
cookie: &[u8]
) -> Result<UnencryptedCsrfCookie, CsrfError>
fn parse_token(&self, token: &[u8]) -> Result<UnencryptedCsrfToken, CsrfError>
[src]
impl CsrfProtection for MultiCsrfProtection
[src]
fn generate_cookie(
&self,
token_value: &[u8; 64],
ttl_seconds: i64
) -> Result<CsrfCookie, CsrfError>
[src]
&self,
token_value: &[u8; 64],
ttl_seconds: i64
) -> Result<CsrfCookie, CsrfError>
fn generate_token(&self, token_value: &[u8; 64]) -> Result<CsrfToken, CsrfError>
[src]
fn parse_cookie(
&self,
cookie: &[u8]
) -> Result<UnencryptedCsrfCookie, CsrfError>
[src]
&self,
cookie: &[u8]
) -> Result<UnencryptedCsrfCookie, CsrfError>