]> git.proxmox.com Git - pve-access-control.git/commitdiff
api: users: use public regex directly to parse out realm
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 2 Jul 2021 11:42:16 +0000 (13:42 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 2 Jul 2021 11:42:16 +0000 (13:42 +0200)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/API2/User.pm

index c6065964d46c1a242e3ae1b28804d4c54916e427..3fa1b65c4a156642bbce5769d61c71db95757799 100644 (file)
@@ -10,6 +10,7 @@ use PVE::JSONSchema qw(get_standard_option register_standard_option);
 use PVE::SafeSyslog;
 
 use PVE::AccessControl;
+use PVE::Auth::Plugin;
 use PVE::TokenConfig;
 
 use PVE::RESTHandler;
@@ -197,9 +198,9 @@ __PACKAGE__->register_method ({
                ];
            }
 
-           my (undef, undef, $realm) = PVE::AccessControl::verify_username($user, 1);
-           if (defined($realm) && exists($domainids->{$realm})) {
-               $entry->{'realm-type'} = $domainids->{$realm}->{type};
+           if ($user =~ /($PVE::Auth::Plugin::realm_regex)$/) {
+               my $realm = $1;
+               $entry->{'realm-type'} = $domainids->{$realm}->{type} if exists $domainids->{$realm};
            }
 
            $entry->{userid} = $user;