pub struct CsrfToken(/* private fields */);
Expand description
Value used for CSRF protection
via the state
parameter.
Implementations§
Source§impl CsrfToken
impl CsrfToken
Sourcepub fn new_random() -> Self
pub fn new_random() -> Self
Generate a new random, base64-encoded 128-bit CSRF token.
Sourcepub fn new_random_len(num_bytes: u32) -> Self
pub fn new_random_len(num_bytes: u32) -> Self
Generate a new random, base64-encoded CSRF token of the specified length.
§Arguments
num_bytes
- Number of random bytes to generate, prior to base64-encoding.
Sourcepub fn secret(&self) -> &String
pub fn secret(&self) -> &String
Get the secret contained within this CsrfToken
.
§Security Warning
Leaking this value may compromise the security of the OAuth2 flow.
Sourcepub fn into_secret(self) -> String
pub fn into_secret(self) -> String
Get the secret contained within this CsrfToken
.
§Security Warning
Leaking this value may compromise the security of the OAuth2 flow.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for CsrfToken
impl<'de> Deserialize<'de> for CsrfToken
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for CsrfToken
impl RefUnwindSafe for CsrfToken
impl Send for CsrfToken
impl Sync for CsrfToken
impl Unpin for CsrfToken
impl UnwindSafe for CsrfToken
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