This commit is contained in:
2026-05-23 02:17:37 +02:00
parent fed75d4820
commit 4f0cbe9145
9 changed files with 247 additions and 63 deletions
+3
View File
@@ -9,11 +9,13 @@ pub struct Claims {
pub expire_at: usize, // Expiration time
pub created_at: usize, // Issued at
pub username: String,
pub is_superuser: bool, // Ajoutez ce champ
}
pub fn create_jwt(
user_id: Uuid,
username: &str,
is_superuser: bool, // Ajoutez l'argument ici
secret: &str,
expiration_seconds: u64,
) -> Result<String, jsonwebtoken::errors::Error> {
@@ -27,6 +29,7 @@ pub fn create_jwt(
expire_at: (now + expiration_seconds) as usize,
created_at: now as usize,
username: username.to_string(),
is_superuser, // Et ici
};
encode(