tfa: derive WebauthnConfigUpdater via api macro

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller
2021-02-03 10:42:29 +01:00
parent 51c80c5a52
commit 7f9d8438ab
2 changed files with 5 additions and 50 deletions

View File

@ -5,6 +5,7 @@ use anyhow::Error;
use crate::api2::types::PROXMOX_CONFIG_DIGEST_SCHEMA;
use proxmox::api::{api, Permission, Router, RpcEnvironment, SubdirMap};
use proxmox::api::schema::Updatable;
use proxmox::list_subdirs_api_method;
use crate::config::tfa::{self, WebauthnConfig, WebauthnConfigUpdater};
@ -73,9 +74,9 @@ pub fn update_webauthn_config(
let digest = proxmox::tools::hex_to_digest(digest)?;
crate::tools::detect_modified_configuration_file(&digest, &wa.digest()?)?;
}
webauthn.apply_to(wa);
wa.update_from::<&str>(webauthn, &[])?;
} else {
tfa.webauthn = Some(webauthn.build()?);
tfa.webauthn = Some(WebauthnConfig::try_build_from(webauthn)?);
}
tfa::write(&tfa)?;