tsk-71: Added methods for token expiration
All checks were successful
Rust Build / Test Suite (pull_request) Successful in 53s
Rust Build / Rustfmt (pull_request) Successful in 39s
Rust Build / Clippy (pull_request) Successful in 46s
Rust Build / build (pull_request) Successful in 38s
Rust Build / Check (pull_request) Successful in 38s

This commit is contained in:
2025-10-18 21:56:24 -04:00
parent 6851fdfdde
commit 25d2e38133

View File

@@ -44,6 +44,12 @@ impl AccessToken {
pub fn bearer_token(&self) -> String {
format!("Bearer {}", self.token)
}
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
}
}
impl Token {
@@ -51,9 +57,10 @@ impl Token {
serde_json::to_string_pretty(&self)
}
// TODO: Implement
pub fn token_expired(&self) -> bool {
false
let current_time = time::OffsetDateTime::now_utc();
let expired = time::OffsetDateTime::from_unix_timestamp(self.expiration).unwrap();
current_time > expired
}
pub fn contains_scope(&self, des_scope: &String) -> bool {