diff --git a/Modules/VMware.vSphere.SsoAdmin/VMware.vSphere.SsoAdmin.psd1 b/Modules/VMware.vSphere.SsoAdmin/VMware.vSphere.SsoAdmin.psd1 index e9795f8..735eac3 100644 --- a/Modules/VMware.vSphere.SsoAdmin/VMware.vSphere.SsoAdmin.psd1 +++ b/Modules/VMware.vSphere.SsoAdmin/VMware.vSphere.SsoAdmin.psd1 @@ -16,7 +16,7 @@ SPDX-License-Identifier: BSD-2-Clause RootModule = 'VMware.vSphere.SsoAdmin.psm1' # Version number of this module. -ModuleVersion = '1.3.0' +ModuleVersion = '1.3.1' # ID used to uniquely identify this module GUID = 'b3e25326-e809-4d68-a252-ca5fcaf1eb8b' diff --git a/Modules/VMware.vSphere.SsoAdmin/net45/VMware.vSphere.SsoAdmin.Utils.dll b/Modules/VMware.vSphere.SsoAdmin/net45/VMware.vSphere.SsoAdmin.Utils.dll index c2c69a6..b08bd67 100644 Binary files a/Modules/VMware.vSphere.SsoAdmin/net45/VMware.vSphere.SsoAdmin.Utils.dll and b/Modules/VMware.vSphere.SsoAdmin/net45/VMware.vSphere.SsoAdmin.Utils.dll differ diff --git a/Modules/VMware.vSphere.SsoAdmin/net45/VMware.vSphere.SsoAdminClient.dll b/Modules/VMware.vSphere.SsoAdmin/net45/VMware.vSphere.SsoAdminClient.dll index 0ee72d1..7d2a651 100644 Binary files a/Modules/VMware.vSphere.SsoAdmin/net45/VMware.vSphere.SsoAdminClient.dll and b/Modules/VMware.vSphere.SsoAdmin/net45/VMware.vSphere.SsoAdminClient.dll differ diff --git a/Modules/VMware.vSphere.SsoAdmin/netcoreapp3.1/VMware.vSphere.SsoAdmin.Utils.dll b/Modules/VMware.vSphere.SsoAdmin/netcoreapp3.1/VMware.vSphere.SsoAdmin.Utils.dll index a8199d1..730e2ac 100644 Binary files a/Modules/VMware.vSphere.SsoAdmin/netcoreapp3.1/VMware.vSphere.SsoAdmin.Utils.dll and b/Modules/VMware.vSphere.SsoAdmin/netcoreapp3.1/VMware.vSphere.SsoAdmin.Utils.dll differ diff --git a/Modules/VMware.vSphere.SsoAdmin/netcoreapp3.1/VMware.vSphere.SsoAdminClient.dll b/Modules/VMware.vSphere.SsoAdmin/netcoreapp3.1/VMware.vSphere.SsoAdminClient.dll index f3a4acb..2087f79 100644 Binary files a/Modules/VMware.vSphere.SsoAdmin/netcoreapp3.1/VMware.vSphere.SsoAdminClient.dll and b/Modules/VMware.vSphere.SsoAdmin/netcoreapp3.1/VMware.vSphere.SsoAdminClient.dll differ diff --git a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/PersonUser.cs b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/PersonUser.cs index 2f40523..4410678 100644 --- a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/PersonUser.cs +++ b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/DataTypes/PersonUser.cs @@ -26,6 +26,8 @@ namespace VMware.vSphere.SsoAdminClient.DataTypes public bool Locked { get; set; } public bool Disabled { get; set; } + public Nullable PasswordExpirationRemainingDays { get; set; } + public SsoAdminClient GetClient() { return _client; } diff --git a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/SsoAdminClient.cs b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/SsoAdminClient.cs index afc4f80..3539f40 100644 --- a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/SsoAdminClient.cs +++ b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/SsoAdminClient.cs @@ -207,6 +207,25 @@ namespace VMware.vSphere.SsoAdminClient name = userName, domain = domain })).Result; + + Nullable passwordRemainingDays = null; + try { + passwordRemainingDays = wsSecurityContext. + InvokeOperation(() => + _ssoAdminBindingClient.GetDaysRemainingUntilPasswordExpirationAsync( + new ManagedObjectReference + { + type = "SsoAdminPrincipalManagementService", + Value = "principalManagementService" + }, + new SsoPrincipalId + { + name = userName, + domain = domain + })).Result; + } catch {} + + return new PersonUser(this) { Name = personUser.id.name, @@ -216,7 +235,8 @@ namespace VMware.vSphere.SsoAdminClient LastName = personUser.details.lastName, EmailAddress = personUser.details.emailAddress, Locked = personUser.locked, - Disabled = personUser.disabled + Disabled = personUser.disabled, + PasswordExpirationRemainingDays = passwordRemainingDays }; } @@ -246,6 +266,18 @@ namespace VMware.vSphere.SsoAdminClient { foreach (var personUser in personUsers) { + Nullable passwordRemainingDays = null; + try { + passwordRemainingDays = authorizedInvocationContext. + InvokeOperation(() => + _ssoAdminBindingClient.GetDaysRemainingUntilPasswordExpirationAsync( + new ManagedObjectReference + { + type = "SsoAdminPrincipalManagementService", + Value = "principalManagementService" + }, + personUser.id)).Result; + } catch {} yield return new PersonUser(this) { Name = personUser.id.name, @@ -255,7 +287,8 @@ namespace VMware.vSphere.SsoAdminClient LastName = personUser.details.lastName, EmailAddress = personUser.details.emailAddress, Locked = personUser.locked, - Disabled = personUser.disabled + Disabled = personUser.disabled, + PasswordExpirationRemainingDays = passwordRemainingDays }; } } @@ -289,8 +322,21 @@ namespace VMware.vSphere.SsoAdminClient { foreach (var personUser in personUsers) { - yield return new PersonUser(this) - { + Nullable passwordRemainingDays = null; + try + { + passwordRemainingDays = authorizedInvocationContext. + InvokeOperation(() => + _ssoAdminBindingClient.GetDaysRemainingUntilPasswordExpirationAsync( + new ManagedObjectReference + { + type = "SsoAdminPrincipalManagementService", + Value = "principalManagementService" + }, + personUser.id)).Result; + } catch {} + yield return new PersonUser(this) + { Name = personUser.id.name, Domain = personUser.id.domain, Description = personUser.details.description, @@ -298,8 +344,9 @@ namespace VMware.vSphere.SsoAdminClient LastName = personUser.details.lastName, EmailAddress = personUser.details.emailAddress, Locked = personUser.locked, - Disabled = personUser.disabled - }; + Disabled = personUser.disabled, + PasswordExpirationRemainingDays = passwordRemainingDays + }; } } } diff --git a/Modules/VMware.vSphere.SsoAdmin/src/test/PersonUser.Tests.ps1 b/Modules/VMware.vSphere.SsoAdmin/src/test/PersonUser.Tests.ps1 index a7ef571..9b825a4 100644 --- a/Modules/VMware.vSphere.SsoAdmin/src/test/PersonUser.Tests.ps1 +++ b/Modules/VMware.vSphere.SsoAdmin/src/test/PersonUser.Tests.ps1 @@ -101,6 +101,7 @@ Describe "PersonUser Tests" { $actual.FirstName | Should -Be $null $actual.LastName | Should -Be $null $actual.EmailAddress | Should -Be $null + $actual.PasswordExpirationRemainingDays | Should -Not -Be $null } } @@ -121,6 +122,7 @@ Describe "PersonUser Tests" { $actual.Count | Should -BeGreaterThan 0 $actual[0].Name | Should -Not -Be $null $actual[0].Domain | Should -Be 'localos' + $actual[0].PasswordExpirationRemainingDays | Should -Not -Be $null } It 'Gets person users by name (exact match) and domain filters' { @@ -278,6 +280,7 @@ Describe "PersonUser Tests" { $actual.Count | Should -BeGreaterThan 0 $actual[0].Name | Should -Not -Be $null $actual[0].Domain | Should -Be 'vsphere.local' + $actual[0].PasswordExpirationRemainingDays | Should -Not -Be $null } }