pub struct SessionMiddleware { /* private fields */ }Expand description
The middleware itself.
Implementations§
Source§impl SessionMiddleware
impl SessionMiddleware
Sourcepub fn new(server_key: &str) -> SessionMiddleware
pub fn new(server_key: &str) -> SessionMiddleware
Create a new instance.
The server_key is used for signing and validating the jwt token.
Sourcepub fn issuer(self, issuer: &str) -> Self
pub fn issuer(self, issuer: &str) -> Self
Set a value for the iss (issuer) jwt claim.
The default is to not set an issuer.
Sourcepub fn expiration_time(self, expiration_time: Duration) -> Self
pub fn expiration_time(self, expiration_time: Duration) -> Self
Set how long a token should be valid after creation (in seconds).
The default is 24 hours.
Sourcepub fn using(self, location: TokenLocation) -> Self
pub fn using(self, location: TokenLocation) -> Self
Set where the token should be stored.
The default is TokenLocation::Cookie("jwt"). Alternatively,
the token can be set in the Authorization: Bearer header.
Trait Implementations§
Source§impl Clone for SessionMiddleware
impl Clone for SessionMiddleware
Source§fn clone(&self) -> SessionMiddleware
fn clone(&self) -> SessionMiddleware
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 Key for SessionMiddleware
impl Key for SessionMiddleware
Source§type Value = SessionMiddleware
type Value = SessionMiddleware
The value type associated with this key type.
Source§impl<D> Middleware<D> for SessionMiddleware
impl<D> Middleware<D> for SessionMiddleware
Auto Trait Implementations§
impl Freeze for SessionMiddleware
impl RefUnwindSafe for SessionMiddleware
impl Send for SessionMiddleware
impl Sync for SessionMiddleware
impl Unpin for SessionMiddleware
impl UnwindSafe for SessionMiddleware
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