Struct csrf::MultiCsrfProtection
[−]
[src]
pub struct MultiCsrfProtection { /* fields omitted */ }
This is used when one wants to rotate keys or switch from implementation to another. It accepts
1 + N
instances of CsrfProtection
and uses only the first to generate tokens and cookies.
The N
remaining instances are used only for parsing.
Methods
impl MultiCsrfProtection
[src]
fn new(current: Box<CsrfProtection>, previous: Vec<Box<CsrfProtection>>) -> Self
[src]
Create a new MultiCsrfProtection
from one current CsrfProtection
and some N
previous
instances of CsrfProtection
.
Trait Implementations
impl CsrfProtection for MultiCsrfProtection
[src]
[src]
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>
[src]
Given a nonce, create a token to send to the end user.
[src]
Given a decoded byte array, deserialize, decrypt, and verify the cookie.
fn parse_token(&self, token: &[u8]) -> Result<UnencryptedCsrfToken, CsrfError>
[src]
Given a decoded byte array, deserialize, decrypt, and verify the token.
fn verify_token_pair(
&self,
token: &UnencryptedCsrfToken,
cookie: &UnencryptedCsrfCookie
) -> bool
[src]
&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. Read more
fn random_bytes(&self, buf: &mut [u8]) -> Result<(), CsrfError>
[src]
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>
[src]
&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.