tsk-192: jsonwebtoken version bump #228
+3
-16
@@ -7,8 +7,8 @@ use axum::{
|
|||||||
use axum_extra::extract::cookie::CookieJar;
|
use axum_extra::extract::cookie::CookieJar;
|
||||||
use jsonwebtoken::{DecodingKey, Validation, decode};
|
use jsonwebtoken::{DecodingKey, Validation, decode};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use thiserror::Error;
|
|
||||||
|
|
||||||
|
// TODO: Put this in icarus_models
|
||||||
fn deserialize_i64_from_f64<'de, D>(deserializer: D) -> Result<i64, D::Error>
|
fn deserialize_i64_from_f64<'de, D>(deserializer: D) -> Result<i64, D::Error>
|
||||||
where
|
where
|
||||||
D: serde::Deserializer<'de>,
|
D: serde::Deserializer<'de>,
|
||||||
@@ -27,7 +27,8 @@ where
|
|||||||
Ok(rounded as i64)
|
Ok(rounded as i64)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
// TODO: Put this in icarus_models
|
||||||
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
pub struct UserClaims {
|
pub struct UserClaims {
|
||||||
pub iss: String,
|
pub iss: String,
|
||||||
pub aud: String, // Audience
|
pub aud: String, // Audience
|
||||||
@@ -42,20 +43,6 @@ pub struct UserClaims {
|
|||||||
pub roles: Option<Vec<String>>, // Optional roles
|
pub roles: Option<Vec<String>>, // 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)]
|
#[derive(Debug, Serialize)]
|
||||||
pub struct ErrorResponse {
|
pub struct ErrorResponse {
|
||||||
pub status: &'static str,
|
pub status: &'static str,
|
||||||
|
|||||||
Reference in New Issue
Block a user