tsk-71: Added expiration check in LoginResult
This commit is contained in:
@@ -28,4 +28,10 @@ impl LoginResult {
|
|||||||
pub fn _to_json(&self) -> Result<String, serde_json::Error> {
|
pub fn _to_json(&self) -> Result<String, serde_json::Error> {
|
||||||
serde_json::to_string_pretty(&self)
|
serde_json::to_string_pretty(&self)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn token_expired(&self) -> bool {
|
||||||
|
let current_time = time::OffsetDateTime::now_utc();
|
||||||
|
let expired = time::OffsetDateTime::from_unix_timestamp(self.expiration).unwrap();
|
||||||
|
current_time > expired
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user