Implement Get/Set-PasswordPolicy cmdlets
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
// **************************************************************************
|
||||
// Copyright (c) VMware, Inc. All rights reserved. -- VMware Confidential.
|
||||
// **************************************************************************
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace VMware.vSphere.SsoAdminClient.DataTypes
|
||||
{
|
||||
public class PasswordPolicy
|
||||
{
|
||||
SsoAdminClient _client;
|
||||
public PasswordPolicy(SsoAdminClient client) {
|
||||
_client = client;
|
||||
}
|
||||
|
||||
public string Description { get; set; }
|
||||
public int ProhibitedPreviousPasswordsCount { get; set; }
|
||||
public int MinLength { get; set; }
|
||||
public int MaxLength { get; set; }
|
||||
public int MinNumericCount { get; set; }
|
||||
public int MinSpecialCharCount { get; set; }
|
||||
public int MaxIdenticalAdjacentCharacters { get; set; }
|
||||
public int MinAlphabeticCount { get; set; }
|
||||
public int MinUppercaseCount { get; set; }
|
||||
public int MinLowercaseCount { get; set; }
|
||||
public int PasswordLifetimeDays { get; set; }
|
||||
|
||||
public SsoAdminClient GetClient() {
|
||||
return _client;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,11 @@ namespace VMware.vSphere.SsoAdminClient.DataTypes
|
||||
{
|
||||
public class PersonUser
|
||||
{
|
||||
SsoAdminClient _client;
|
||||
public PersonUser(SsoAdminClient client) {
|
||||
_client = client;
|
||||
}
|
||||
|
||||
public string Name { get; set; }
|
||||
public string Domain { get; set; }
|
||||
public string Description { get; set; }
|
||||
@@ -18,6 +23,10 @@ namespace VMware.vSphere.SsoAdminClient.DataTypes
|
||||
public string LastName { get; set; }
|
||||
public string EmailAddress { get; set; }
|
||||
|
||||
public SsoAdminClient GetClient() {
|
||||
return _client;
|
||||
}
|
||||
|
||||
public override string ToString() {
|
||||
return $"{Name}@{Domain}";
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace VMware.vSphere.SsoAdminClient
|
||||
|
||||
private void RenewIfNeeded() {
|
||||
if (_validToken == null ||
|
||||
_validToken.Expires < (DateTime.Now - new TimeSpan(0, 0, 30))) {
|
||||
_validToken.Expires < (DateTime.Now + new TimeSpan(0, 0, 30))) {
|
||||
_validToken = _stsClient.IssueBearerTokenByUserCredential(
|
||||
_user,
|
||||
_password);
|
||||
|
||||
Reference in New Issue
Block a user