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