pub struct Session {
pub token: SessionToken,
pub user_id: UserId,
pub user_agent: Option<String>,
pub ip_address: Option<String>,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
pub expires_at: DateTime<Utc>,
}Fields§
§token: SessionTokenThe unique identifier for the session.
user_id: UserIdThe unique identifier for the user.
user_agent: Option<String>The user agent of the client that created the session.
ip_address: Option<String>The IP address of the client that created the session.
created_at: DateTime<Utc>The timestamp when the session was created.
updated_at: DateTime<Utc>The timestamp when the session was last updated.
expires_at: DateTime<Utc>The timestamp when the session will expire.
Implementations§
Source§impl Session
impl Session
pub fn builder() -> SessionBuilder
pub fn is_expired(&self) -> bool
Sourcepub fn to_jwt_claims(
&self,
issuer: Option<String>,
include_metadata: bool,
) -> JwtClaims
pub fn to_jwt_claims( &self, issuer: Option<String>, include_metadata: bool, ) -> JwtClaims
Convert session to JWT claims
Sourcepub fn from_jwt_claims(token: SessionToken, claims: &JwtClaims) -> Self
pub fn from_jwt_claims(token: SessionToken, claims: &JwtClaims) -> Self
Create a session from JWT claims
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Session
impl<'de> Deserialize<'de> for Session
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 Session
impl RefUnwindSafe for Session
impl Send for Session
impl Sync for Session
impl Unpin for Session
impl UnwindSafe for Session
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.