pub struct SignedJar<'key, J> { /* private fields */ }Expand description
A Cookies adapter that signs cookies written through it and verifies
cookies read through it, using a Key.
Signing detects changes to a cookie’s value while leaving it readable by
the client. Create a signed jar with Cookies::signed or
signed_cookies.
Reads return None for missing cookies or invalid signatures. This adapter
can be combined with prefixes and attribute defaults.
Trait Implementations§
Source§impl<J: Cookies> Cookies for SignedJar<'_, J>
impl<J: Cookies> Cookies for SignedJar<'_, J>
Source§fn get(&self, name: &str) -> Option<Cookie<'static>>
fn get(&self, name: &str) -> Option<Cookie<'static>>
Returns the cookie named
name, or None if it is absent (or, for
signed/encrypted jars, fails to verify).Source§fn add<C: Into<Cookie<'static>>>(&self, cookie: C)
fn add<C: Into<Cookie<'static>>>(&self, cookie: C)
Adds
cookie. It is serialized into a Set-Cookie response header once
the cookie router layer handles the response. Read moreSource§fn remove<C: Into<Cookie<'static>>>(&self, cookie: C)
fn remove<C: Into<Cookie<'static>>>(&self, cookie: C)
Removes
cookie. If the request carried an original cookie with the
same name, an expiring removal cookie is sent. Pass the same Path/
Domain the cookie was set with. Read moreSource§fn signed(self, key: &Key) -> SignedJar<'_, Self>where
Self: Sized,
fn signed(self, key: &Key) -> SignedJar<'_, Self>where
Self: Sized,
Wraps this jar so signed cookies are written and verified with
key.Source§fn private(self, key: &Key) -> PrivateJar<'_, Self>where
Self: Sized,
fn private(self, key: &Key) -> PrivateJar<'_, Self>where
Self: Sized,
Wraps this jar so cookies are encrypted and decrypted with
key.Source§fn map<F>(self, f: F) -> Map<Self, F>
fn map<F>(self, f: F) -> Map<Self, F>
Wraps this jar so every added cookie is passed through
f before being
stored. Use this for custom attribute changes.Source§fn override_prefix_host(self) -> Prefixed<Self>where
Self: Sized,
fn override_prefix_host(self) -> Prefixed<Self>where
Self: Sized,
Forces the
__Host- prefix and its required attributes (Secure,
Path=/, no Domain) on every added cookie.Source§fn default_prefix_host(self) -> Prefixed<Self>where
Self: Sized,
fn default_prefix_host(self) -> Prefixed<Self>where
Self: Sized,
Applies the
__Host- prefix, filling its required attributes only when
the cookie does not already set them.Source§fn override_prefix_secure(self) -> Prefixed<Self>where
Self: Sized,
fn override_prefix_secure(self) -> Prefixed<Self>where
Self: Sized,
Forces the
__Secure- prefix and its required Secure attribute on
every added cookie.Source§fn default_prefix_secure(self) -> Prefixed<Self>where
Self: Sized,
fn default_prefix_secure(self) -> Prefixed<Self>where
Self: Sized,
Applies the
__Secure- prefix, setting Secure only when the cookie
does not already set it.Source§fn override_secure(
self,
value: bool,
) -> Map<Self, impl Fn(&mut Cookie<'static>)>where
Self: Sized,
fn override_secure(
self,
value: bool,
) -> Map<Self, impl Fn(&mut Cookie<'static>)>where
Self: Sized,
Sets
Secure on every added cookie, overriding any existing value.Source§fn default_secure(self, value: bool) -> Map<Self, impl Fn(&mut Cookie<'static>)>where
Self: Sized,
fn default_secure(self, value: bool) -> Map<Self, impl Fn(&mut Cookie<'static>)>where
Self: Sized,
Sets
Secure on added cookies that do not already specify it.Source§fn override_http_only(
self,
value: bool,
) -> Map<Self, impl Fn(&mut Cookie<'static>)>where
Self: Sized,
fn override_http_only(
self,
value: bool,
) -> Map<Self, impl Fn(&mut Cookie<'static>)>where
Self: Sized,
Sets
HttpOnly on every added cookie, overriding any existing value.Source§fn default_http_only(
self,
value: bool,
) -> Map<Self, impl Fn(&mut Cookie<'static>)>where
Self: Sized,
fn default_http_only(
self,
value: bool,
) -> Map<Self, impl Fn(&mut Cookie<'static>)>where
Self: Sized,
Sets
HttpOnly on added cookies that do not already specify it.Source§fn override_same_site(
self,
value: SameSite,
) -> Map<Self, impl Fn(&mut Cookie<'static>)>where
Self: Sized,
fn override_same_site(
self,
value: SameSite,
) -> Map<Self, impl Fn(&mut Cookie<'static>)>where
Self: Sized,
Sets
SameSite on every added cookie, overriding any existing value.Source§fn default_same_site(
self,
value: SameSite,
) -> Map<Self, impl Fn(&mut Cookie<'static>)>where
Self: Sized,
fn default_same_site(
self,
value: SameSite,
) -> Map<Self, impl Fn(&mut Cookie<'static>)>where
Self: Sized,
Sets
SameSite on added cookies that do not already specify it.Source§fn override_path(
self,
value: impl Into<String>,
) -> Map<Self, impl Fn(&mut Cookie<'static>)>where
Self: Sized,
fn override_path(
self,
value: impl Into<String>,
) -> Map<Self, impl Fn(&mut Cookie<'static>)>where
Self: Sized,
Sets
Path on every added cookie, overriding any existing value.Source§fn default_path(
self,
value: impl Into<String>,
) -> Map<Self, impl Fn(&mut Cookie<'static>)>where
Self: Sized,
fn default_path(
self,
value: impl Into<String>,
) -> Map<Self, impl Fn(&mut Cookie<'static>)>where
Self: Sized,
Sets
Path on added cookies that do not already specify it.Source§fn override_domain(
self,
value: impl Into<String>,
) -> Map<Self, impl Fn(&mut Cookie<'static>)>where
Self: Sized,
fn override_domain(
self,
value: impl Into<String>,
) -> Map<Self, impl Fn(&mut Cookie<'static>)>where
Self: Sized,
Sets
Domain on every added cookie, overriding any existing value.Source§fn default_domain(
self,
value: impl Into<String>,
) -> Map<Self, impl Fn(&mut Cookie<'static>)>where
Self: Sized,
fn default_domain(
self,
value: impl Into<String>,
) -> Map<Self, impl Fn(&mut Cookie<'static>)>where
Self: Sized,
Sets
Domain on added cookies that do not already specify it.impl<'key, J: Copy> Copy for SignedJar<'key, J>
Auto Trait Implementations§
impl<'key, J> Freeze for SignedJar<'key, J>where
J: Freeze,
impl<'key, J> RefUnwindSafe for SignedJar<'key, J>where
J: RefUnwindSafe,
impl<'key, J> Send for SignedJar<'key, J>where
J: Send,
impl<'key, J> Sync for SignedJar<'key, J>where
J: Sync,
impl<'key, J> Unpin for SignedJar<'key, J>where
J: Unpin,
impl<'key, J> UnsafeUnpin for SignedJar<'key, J>where
J: UnsafeUnpin,
impl<'key, J> UnwindSafe for SignedJar<'key, J>where
J: UnwindSafe,
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