Skip to content

Commit

Permalink
Closes #24
Browse files Browse the repository at this point in the history
- Fix bug in cache script
- Bump module version
  • Loading branch information
fireflycons committed Jan 15, 2020
1 parent de900d8 commit f9058fd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
34 changes: 17 additions & 17 deletions aws-toolbox/Public/IAM/Set-ATIAMCliExternalCredentials.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function Set-ATIAMCliExternalCredentials
{
# Decode secure string back to JSON
$ss = ConvertTo-SecureString $profile.Credential
$json = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto(([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR(([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($ss)))))
$json = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto(([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($ss)))

# Check credential time
$cred = $json | ConvertFrom-Json
Expand All @@ -89,27 +89,27 @@ function Set-ATIAMCliExternalCredentials
{
Import-Module aws-toolbox.netcore
}
}

Set-AwsCredential -ProfileName $profileName
$json = Get-ATIAMSessionCredentials -AwsCli
Set-AwsCredential -ProfileName $profileName
$json = Get-ATIAMSessionCredentials -AwsCli

$encryptedCredential = $json | ConvertTo-SecureString -AsPlainText -Force | ConvertFrom-SecureString
$encryptedCredential = $json | ConvertTo-SecureString -AsPlainText -Force | ConvertFrom-SecureString

if ($profile)
{
$profile.Credential = $encryptedCredential
}
else
{
$profiles += New-Object PSObject -Property @{
Name = $profileName
Credential = $encryptedCredential
if ($profile)
{
$profile.Credential = $encryptedCredential
}
else
{
$profiles += New-Object PSObject -Property @{
Name = $profileName
Credential = $encryptedCredential
}
}
}

# Write out credential cache
$profiles | Set-Content -Path $credentialCache -Force
# Write out credential cache
$profiles | ConvertTo-Json | Set-Content -Path $credentialCache -Force
}
}
finally
{
Expand Down
2 changes: 1 addition & 1 deletion aws-toolbox/aws-toolbox.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
RootModule = 'aws-toolbox.psm1'

# Version number of this module.
ModuleVersion = '0.17.1'
ModuleVersion = '0.17.2'

# ID used to uniquely identify this module
GUID = 'e3c04d58-4e7d-4572-9e81-3b3a93f1a518'
Expand Down

0 comments on commit f9058fd

Please sign in to comment.