pub struct HmacCsrfProtection { /* private fields */ }
Expand description
Uses HMAC to provide authenticated CSRF tokens and cookies.
Implementations§
Trait Implementations§
Source§impl Clone for HmacCsrfProtection
impl Clone for HmacCsrfProtection
Source§fn clone(&self) -> HmacCsrfProtection
fn clone(&self) -> HmacCsrfProtection
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl CsrfProtection for HmacCsrfProtection
impl CsrfProtection for HmacCsrfProtection
Given a nonce and a time to live (TTL), create a cookie to send to the end user.
Source§fn generate_token(&self, token_value: &[u8; 64]) -> Result<CsrfToken, CsrfError>
fn generate_token(&self, token_value: &[u8; 64]) -> Result<CsrfToken, CsrfError>
Given a nonce, create a token to send to the end user.
Given a decoded byte array, deserialize, decrypt, and verify the cookie.
Source§fn parse_token(&self, token: &[u8]) -> Result<UnencryptedCsrfToken, CsrfError>
fn parse_token(&self, token: &[u8]) -> Result<UnencryptedCsrfToken, CsrfError>
Given a decoded byte array, deserialize, decrypt, and verify the token.
Source§fn verify_token_pair(
&self,
token: &UnencryptedCsrfToken,
cookie: &UnencryptedCsrfCookie,
) -> Result<(), CsrfError>
fn verify_token_pair( &self, token: &UnencryptedCsrfToken, cookie: &UnencryptedCsrfCookie, ) -> Result<(), CsrfError>
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.
Auto Trait Implementations§
impl Freeze for HmacCsrfProtection
impl RefUnwindSafe for HmacCsrfProtection
impl Send for HmacCsrfProtection
impl Sync for HmacCsrfProtection
impl Unpin for HmacCsrfProtection
impl UnwindSafe for HmacCsrfProtection
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more