Implement ResetPassword and Unlock for PersonUser accounts.

This commit is contained in:
dmilov
2020-09-29 17:16:47 +03:00
parent 5fb63bb345
commit b8030e4272
6 changed files with 160 additions and 2 deletions

View File

@@ -302,6 +302,42 @@ namespace VMware.vSphere.SsoAdminClient
},
group.Name)).Result;
}
public void ResetPersonUserPassword(PersonUser user, string newPassword) {
// Create Authorization Invocation Context
var authorizedInvocationContext =
CreateAuthorizedInvocationContext();
// Invoke SSO Admin ResetLocalPersonUserPasswordAsync operation
authorizedInvocationContext.
InvokeOperation(() =>
_ssoAdminBindingClient.ResetLocalPersonUserPasswordAsync(
new ManagedObjectReference {
type = "SsoAdminPrincipalManagementService",
Value = "principalManagementService"
},
user.Name,
newPassword)).Wait();
}
public bool UnlockPersonUser(PersonUser user) {
// Create Authorization Invocation Context
var authorizedInvocationContext =
CreateAuthorizedInvocationContext();
// Invoke SSO Admin UnlockUserAccountAsync operation
return authorizedInvocationContext.
InvokeOperation(() =>
_ssoAdminBindingClient.UnlockUserAccountAsync(
new ManagedObjectReference {
type = "SsoAdminPrincipalManagementService",
Value = "principalManagementService"
},
new SsoPrincipalId {
name = user.Name,
domain = user.Domain
})).Result;
}
#endregion
}
}