Skip to content

Commit

Permalink
New-TssSession - fixes #241
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmelton committed Sep 15, 2021
1 parent 0dd09c4 commit 90343b3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Thycotic.SecretServer/Thycotic.SecretServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CsvHelper" Version="27.1.1"/>
<PackageReference Include="PowerShellStandard.Library" Version="5.1.0">
<PackageReference Include="PowerShellStandard.Library" Version="7.0.0-preview.1">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="RestSharp" Version="106.11.8-alpha.0.14"/>
Expand Down
5 changes: 2 additions & 3 deletions src/Thycotic.SecretServer/cmdlets/private/NewTssApiToken.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class NameCmdlet : PSCmdlet
public string Username { get; set; }

[Parameter(Mandatory = true, Position = 2)]
public SecureString Password { get; set; }
public string Password { get; set; }

[Parameter(Position = 3)]
public int OtpCode { get; set; }
Expand Down Expand Up @@ -70,9 +70,8 @@ protected override void ProcessRecord()
apiRequest.AddParameter("otp", OtpCode.ToString(), ParameterType.HttpHeader);
}

var dPassword = Marshal.PtrToStringAuto(Marshal.SecureStringToBSTR(Password));
apiRequest.AddParameter("username", Username);
apiRequest.AddParameter("password", dPassword);
apiRequest.AddParameter("password", Password);
apiRequest.AddParameter("grant_type", "password");

IRestResponse apiResponse = apiClient.Execute(apiRequest);
Expand Down
2 changes: 1 addition & 1 deletion src/functions/authentication/New-TssSession.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ function New-TssSession {
}

$newTokenParams.Username = $Credential.Username
$newTokenParams.Password = $Credential.Password
$newTokenParams.Password = $Credential.GetNetworkCredential().Password

if (-not $PSCmdlet.ShouldProcess($outputTssSession.SecretServer, "Requesting OAuth2 token from $($outputTssSession.SecretServer) with URI of [$($newTokenParams.Uri)]")) { return }
Write-Verbose "Performing the operation POST $($newTokenParams.Uri)"
Expand Down

0 comments on commit 90343b3

Please sign in to comment.