Skip to content

Commit

Permalink
TssSecret - GetCredential method update closes #133
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmelton committed Mar 30, 2021
1 parent 92f32e0 commit 92e8a1e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/classes/secrets/TssSecret.class.ps1
Expand Up @@ -123,10 +123,11 @@ class TssSecret {
$ResponseCodes

[System.Management.Automation.PSCredential]
GetCredential() {
$username = ($this.Items | Where-Object FieldName -EQ 'username').ItemValue
$passwd = ($this.Items | Where-Object IsPassword).ItemValue
return [pscredential]::new($username,(ConvertTo-SecureString -AsPlainText -Force -String $passwd))
GetCredential([string]$DomainField, [string]$UserField, [string]$PwdField) {
$domain = ($this.Items.Where( { $_.FieldName -eq $DomainField })).ItemValue
$username = ($this.Items.Where( { $_.FieldName -eq $UserField })).ItemValue
$passwd = ($this.Items.Where( { $_.FieldName -eq $PwdField })).ItemValue
return [pscredential]::new((($domain,$username -join '\').Trim('\')),(ConvertTo-SecureString -AsPlainText -Force -String $passwd))
}

[System.String]
Expand Down

0 comments on commit 92e8a1e

Please sign in to comment.