summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server/src/models/auth.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/server/src/models/auth.rs b/server/src/models/auth.rs
index 1e466d3..f798eee 100644
--- a/server/src/models/auth.rs
+++ b/server/src/models/auth.rs
@@ -102,6 +102,13 @@ where
let token_data = decode::<Claims>(bearer.token(), &KEYS.decoding, &Validation::default())
.map_err(|_| AppError::InvalidToken)?;
+ let now = Local::now().timestamp() as usize;
+
+ // Handle the case of expired token
+ if token_data.claims.exp < now {
+ return Err(AppError::InvalidToken);
+ }
+
Ok(token_data.claims)
}
}