init
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user