pub struct Sessions { /* private fields */ }Expand description
Session manager: holds the signing secret and cookie policy.
Implementations§
Source§impl Sessions
impl Sessions
Sourcepub fn new(secret: &[u8]) -> Sessions
pub fn new(secret: &[u8]) -> Sessions
Create a manager from a secret (use a long, random, configured value).
Sourcepub fn insecure(self) -> Sessions
pub fn insecure(self) -> Sessions
Drop the Secure attribute (for local http:// development only).
pub fn max_age(self, secs: Option<u64>) -> Sessions
Sourcepub fn token(&self, value: &str) -> String
pub fn token(&self, value: &str) -> String
Sign an arbitrary value into a <value-hex>.<sig> token (CSRF tokens,
password-reset links, …). Verify with verify_token.
Sourcepub fn verify_token(&self, token: &str) -> Option<String>
pub fn verify_token(&self, token: &str) -> Option<String>
Verify a token from token; returns the original value.
Sourcepub fn load(&self, req: &Request) -> Session
pub fn load(&self, req: &Request) -> Session
Load and verify the session from the request cookie; returns an empty session if absent, tampered, or malformed.
Auto Trait Implementations§
impl Freeze for Sessions
impl RefUnwindSafe for Sessions
impl Send for Sessions
impl Sync for Sessions
impl Unpin for Sessions
impl UnsafeUnpin for Sessions
impl UnwindSafe for Sessions
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