Implement update authentication credential for LDAP identity sources (#516)

Signed-off-by: Dimitar Milov <dmilov@vmware.com>
This commit is contained in:
dmilov
2021-12-22 12:34:59 +02:00
committed by GitHub
parent 13d0ef4b86
commit 1d96b6a340
9 changed files with 147 additions and 19 deletions

View File

@@ -1113,7 +1113,7 @@ namespace VMware.vSphere.SsoAdminClient
string baseDNUsers,
string baseDNGroups,
string authenticationUserName,
string authenticationPassword,
SecureString authenticationPassword,
string serverType,
X509Certificate2[] ldapCertificates)
{
@@ -1163,7 +1163,7 @@ namespace VMware.vSphere.SsoAdminClient
new SsoAdminIdentitySourceManagementServiceAuthenticationCredentials
{
username = authenticationUserName,
password = authenticationPassword
password = SecureStringToString(authenticationPassword)
})).Wait();
}
catch (AggregateException e)
@@ -1227,6 +1227,40 @@ namespace VMware.vSphere.SsoAdminClient
}
}
public void UpdateLdapIdentitySourceAuthentication(
string name,
string authenticationUserName,
SecureString authenticationPassword)
{
string authenticationType = "password";
var authorizedInvocationContext =
CreateAuthorizedInvocationContext();
try
{
authorizedInvocationContext.
InvokeOperation(() =>
_ssoAdminBindingClient.UpdateLdapAuthnTypeAsync(
new ManagedObjectReference
{
type = "SsoAdminIdentitySourceManagementService",
Value = "identitySourceManagementService"
},
name,
authenticationType,
new SsoAdminIdentitySourceManagementServiceAuthenticationCredentials
{
username = authenticationUserName,
password = SecureStringToString(authenticationPassword)
})).Wait();
}
catch (AggregateException e)
{
throw e.InnerException;
}
}
public IEnumerable<IdentitySource> GetDomains()
{
var authorizedInvocationContext =