Address PR discussions
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
// **************************************************************************
|
||||
// Copyright 2020 VMware, Inc.
|
||||
// **************************************************************************
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Management.Automation;
|
||||
using System.Security;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace VMware.vSphere.SsoAdmin.Utils
|
||||
{
|
||||
public class StirngToSecureStringArgumentTransformationAttribute : ArgumentTransformationAttribute
|
||||
{
|
||||
private static class SecureStringConverter
|
||||
{
|
||||
public static SecureString ToSecureString(string value) {
|
||||
var result = new SecureString();
|
||||
|
||||
foreach (var c in value.ToCharArray()) {
|
||||
result.AppendChar(c);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public override object Transform(EngineIntrinsics engineIntrinsics, object inputData) {
|
||||
object result = inputData;
|
||||
if (inputData is string s) {
|
||||
result = SecureStringConverter.ToSecureString(s);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,9 +14,11 @@
|
||||
<PackageReference Include="System.ServiceModel.Http" Version="4.4.0" />
|
||||
<PackageReference Include="System.ServiceModel.NetTcp" Version="4.4.0" />
|
||||
<PackageReference Include="System.ServiceModel.Security" Version="4.4.0" />
|
||||
<PackageReference Include="Microsoft.PowerShell.5.ReferenceAssemblies" Version="1.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.0'">
|
||||
<PackageReference Include="Microsoft.WSMan.Runtime" Version="6.1.0" />
|
||||
<PackageReference Include="VMware.System.Private.ServiceModel" Version="4.4.4" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user