]> git.proxmox.com Git - pve-access-control.git/blobdiff - PVE/API2/Domains.pm
add basic support for two factor auth
[pve-access-control.git] / PVE / API2 / Domains.pm
index 10515c0da9f3cc43e9d8b46b6ef217466eedcd5b..dac56608da05aec8e639187514433308d6b2e63f 100644 (file)
@@ -34,6 +34,13 @@ __PACKAGE__->register_method ({
            type => "object",
            properties => {
                realm => { type => 'string' },
+               tfa => {
+                   description => "Two-factor authentication provider.",
+                   type => 'string',
+                   enum => [ 'yubico' ],
+                   optional => 1,
+               },
+               comment => { type => 'string', optional => 1 },
                comment => { type => 'string', optional => 1 },
            },
        },
@@ -52,6 +59,9 @@ __PACKAGE__->register_method ({
            my $entry = { realm => $realm, type => $d->{type} };
            $entry->{comment} = $d->{comment} if $d->{comment};
            $entry->{default} = 1 if $d->{default};
+           if ($d->{tfa} && (my $tfa_cfg = PVE::Auth::Plugin::parse_tfa_config($d->{tfa}))) {
+               $entry->{tfa} = $tfa_cfg->{type};
+           }
            push @$res, $entry;
        }