feat: get_web_login_auth on the vCenter, a source per provider and SSO domain (NetOrk/netork#662)
The vCenter driver reads how people log in to the vSphere Client, in napalm-device-types' WebLoginAuthDict: each identity provider of identity federation (GET /api/vcenter/identity/providers) is a source that decides itself (external), the default first; each SSO domain the vSphere API names (UserDirectory.domainList) is a source whose second factor cannot be read (unknown), since smart card and RSA SecurID live in SSO's authentication policy, which neither API exposes. Listing the providers needs VcIdentityProviders.Read and .Manage; without them the vCenter answers 403 and the driver raises PermissionError naming them. The REST read logs in to /api/session with the same account and logs out after. The ESXi driver has no reader.
This commit is contained in:
1 parent
e1677bebb2
commit
ab18ca87ca
10 files changed
+529
-6
No files matched your search
@@ -131,3 +131,20 @@ def test_raw_properties_keep_the_pyvmomi_objects(content):
|
||||
vim.VirtualMachine("vm-1", None), ["config.hardware.device"], raw=True
|
||||
)
|
||||
assert props["config.hardware.device"][0] is disk
|
||||
|
||||
|
||||
def test_sso_domains_are_read_from_the_user_directory(content):
|
||||
"""The SSO domains a vCenter login can name (NetOrk/netork#662)."""
|
||||
content.userDirectory = vim.UserDirectory("UserDirectory", None)
|
||||
content.propertyCollector.RetrievePropertiesEx.return_value = SimpleNamespace(
|
||||
objects=[
|
||||
_content(vim.UserDirectory("UserDirectory", None), {"domainList": ["vsphere.local"]})
|
||||
],
|
||||
token=None,
|
||||
)
|
||||
assert Inventory(content).sso_domains() == ["vsphere.local"]
|
||||
|
||||
|
||||
def test_sso_domains_empty_without_a_user_directory(content):
|
||||
content.userDirectory = None
|
||||
assert Inventory(content).sso_domains() == []
|
||||
Reference in new issue
Block a user