pub trait TokenStore: Send + Sync {
// Required methods
fn read<'a>(&'a self, cx: &'a Cx) -> TokenStoreFuture<'a, Option<Token>>;
fn write<'a>(
&'a self,
cx: &'a Cx,
token: Token,
max_age: Duration,
) -> TokenStoreFuture<'a, ()>;
fn delete<'a>(&'a self, cx: &'a Cx) -> TokenStoreFuture<'a, ()>;
}Expand description
The client-side transport for the session token.
A token store moves the raw Token between the client and the server;
it is not the session database, which the application owns. The default
CookieTokenStore carries the token in a
hardened cookie; implement this trait to carry it elsewhere, such as an
Authorization header.
Required Methods§
Sourcefn read<'a>(&'a self, cx: &'a Cx) -> TokenStoreFuture<'a, Option<Token>>
fn read<'a>(&'a self, cx: &'a Cx) -> TokenStoreFuture<'a, Option<Token>>
Reads the token presented by the current request, or None when the
request carries none (or a malformed one).
Sourcefn write<'a>(
&'a self,
cx: &'a Cx,
token: Token,
max_age: Duration,
) -> TokenStoreFuture<'a, ()>
fn write<'a>( &'a self, cx: &'a Cx, token: Token, max_age: Duration, ) -> TokenStoreFuture<'a, ()>
Issues token to the client with the given time to live, replacing
any previously issued token.
Sourcefn delete<'a>(&'a self, cx: &'a Cx) -> TokenStoreFuture<'a, ()>
fn delete<'a>(&'a self, cx: &'a Cx) -> TokenStoreFuture<'a, ()>
Instructs the client to discard its token.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".