diff --git a/src/auth.rs b/src/auth.rs index d707b8e..caae917 100644 --- a/src/auth.rs +++ b/src/auth.rs @@ -7,8 +7,8 @@ use axum::{ use axum_extra::extract::cookie::CookieJar; use jsonwebtoken::{DecodingKey, Validation, decode}; use serde::{Deserialize, Serialize}; -use thiserror::Error; +// TODO: Put this in icarus_models fn deserialize_i64_from_f64<'de, D>(deserializer: D) -> Result where D: serde::Deserializer<'de>, @@ -27,7 +27,8 @@ where Ok(rounded as i64) } -#[derive(Debug, Serialize, Deserialize)] +// TODO: Put this in icarus_models +#[derive(Clone, Debug, Serialize, Deserialize)] pub struct UserClaims { pub iss: String, pub aud: String, // Audience @@ -42,20 +43,6 @@ pub struct UserClaims { pub roles: Option>, // Optional roles } -#[derive(Error, Debug)] -pub enum JwtError { - #[error("Token creation failed")] - TokenCreation, - #[error("Token verification failed")] - TokenVerification, - #[error("Invalid token")] - InvalidToken, - #[error("Token expired")] - ExpiredToken, - #[error("Invalid key")] - InvalidKey, -} - #[derive(Debug, Serialize)] pub struct ErrorResponse { pub status: &'static str,