mirror of
https://git.proxmox.com/git/proxmox-perl-rs
synced 2025-05-23 18:27:23 +00:00
pve: TfaConfig: add_totp_entry, add_yubico_entry
fast path to add those two from the old user.cfg Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
3e5228dd73
commit
41ccaa5048
@ -357,6 +357,37 @@ mod export {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Add a totp entry without validating it, used for user.cfg keys.
|
||||||
|
/// Returns the ID.
|
||||||
|
#[export]
|
||||||
|
fn add_totp_entry(
|
||||||
|
#[try_from_ref] this: &Tfa,
|
||||||
|
userid: &str,
|
||||||
|
description: String,
|
||||||
|
totp: String,
|
||||||
|
) -> Result<String, Error> {
|
||||||
|
Ok(this
|
||||||
|
.inner
|
||||||
|
.lock()
|
||||||
|
.unwrap()
|
||||||
|
.add_totp(userid, description, totp.parse()?))
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Add a yubico entry without validating it, used for user.cfg keys.
|
||||||
|
/// Returns the ID.
|
||||||
|
#[export]
|
||||||
|
fn add_yubico_entry(
|
||||||
|
#[try_from_ref] this: &Tfa,
|
||||||
|
userid: &str,
|
||||||
|
description: String,
|
||||||
|
yubico: String,
|
||||||
|
) -> String {
|
||||||
|
this.inner
|
||||||
|
.lock()
|
||||||
|
.unwrap()
|
||||||
|
.add_yubico(userid, description, yubico)
|
||||||
|
}
|
||||||
|
|
||||||
#[export]
|
#[export]
|
||||||
fn api_update_tfa_entry(
|
fn api_update_tfa_entry(
|
||||||
#[try_from_ref] this: &Tfa,
|
#[try_from_ref] this: &Tfa,
|
||||||
|
Loading…
Reference in New Issue
Block a user