From aba9eadc86e213ba98c03d59f34125902a27cb4d Mon Sep 17 00:00:00 2001 From: Jacek Chmielewski Date: Wed, 2 Jul 2025 13:39:36 +0200 Subject: [PATCH] Fix auth key delete endpoint --- crates/defguard_core/src/db/models/authentication_key.rs | 2 +- crates/defguard_core/src/handlers/ssh_authorized_keys.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/defguard_core/src/db/models/authentication_key.rs b/crates/defguard_core/src/db/models/authentication_key.rs index 260ab50feb..5f95109448 100644 --- a/crates/defguard_core/src/db/models/authentication_key.rs +++ b/crates/defguard_core/src/db/models/authentication_key.rs @@ -11,7 +11,7 @@ pub enum AuthenticationKeyType { Gpg, } -#[derive(Deserialize, Model, Serialize)] +#[derive(Clone, Deserialize, Model, Serialize)] #[table(authentication_key)] pub struct AuthenticationKey { pub(crate) id: I, diff --git a/crates/defguard_core/src/handlers/ssh_authorized_keys.rs b/crates/defguard_core/src/handlers/ssh_authorized_keys.rs index 7916dd667d..35adb62fc7 100644 --- a/crates/defguard_core/src/handlers/ssh_authorized_keys.rs +++ b/crates/defguard_core/src/handlers/ssh_authorized_keys.rs @@ -248,7 +248,7 @@ pub async fn delete_authentication_key( if !session.is_admin && user.id != key.user_id { return Err(WebError::Forbidden(String::new())); } - + key.clone().delete(&appstate.pool).await?; info!( "Removed key \"{:?}\"({}) of type {:?} for user {username}", key.name, key.id, key.key_type