Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix session TokenType #73

Merged
merged 4 commits into from
Feb 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

* None
* `New-TssSession` - fixed token type when AccessToken parameter is used. [26720ba](https://github.com/thycotic-ps/thycotic.secretserver/pull/73/commits/26720ba9d37b3f2c6c8986a2f1b2ed30dc5c20e7)
peetrike marked this conversation as resolved.
Show resolved Hide resolved

## [0.29.0] -- 2021-xx-xx

Expand Down
4 changes: 2 additions & 2 deletions src/functions/New-Session.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@

if ($newTssParams.ContainsKey('AccessToken')) {
$outputTssSession.AccessToken = $AccessToken
$outputTssSession.TokenType = 'External'
$outputTssSession.TokenType = 'ExternalToken'
}

$outputTssSession.StartTime = [datetime]::Now
Expand All @@ -126,4 +126,4 @@
Write-Warning "SecretServer argument not found"
}
}
}
}
9 changes: 8 additions & 1 deletion tests/functions/New-TssSession.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ Describe "$commandName works" {
It "SessionExpire() method should return true" {
$sessionCredential.SessionExpire() | Should -Be $true
}
It "Sets correct TokenType" {
$sessionAccessToken.TokenType | Should -BeIn @('bearer')
}

}
Context "AccessToken parameter" {
It "Should set SecretServer to <_>" -TestCases $secretServerHost {
Expand All @@ -98,5 +102,8 @@ Describe "$commandName works" {
$currentTime = [datetime]::UtcNow
$sessionAccessToken.StartTime | Should -BeLessOrEqual $currentTime
}
It "Sets correct TokenType" {
peetrike marked this conversation as resolved.
Show resolved Hide resolved
$sessionAccessToken.TokenType | Should -be 'ExternalToken'
}
}
}
}