Skip to content

Commit

Permalink
Added private function for fixing TLS connections
Browse files Browse the repository at this point in the history
fixes #84
  • Loading branch information
lipkau committed Mar 17, 2018
1 parent 85d3a35 commit 9a5b636
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions JiraPS/Private/Set-TlsLevel.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
function Set-TlsLevel {
[CmdletBinding( SupportsShouldProcess = $false )]
[System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseShouldProcessForStateChangingFunctions', '')]
param (
[Parameter(Mandatory, ParameterSetName = 'Set')]
[Switch]$Tls12,

[Parameter(Mandatory, ParameterSetName = 'Revert')]
[Switch]$Revert
)

begin {
switch ($PSCmdlet.ParameterSetName) {
"Set" {
$Script:OriginalTlsSettings = [Net.ServicePointManager]::SecurityProtocol

[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.ServicePointManager]::Tls12
}
"Revert" {
[Net.ServicePointManager]::SecurityProtocol = $Script:OriginalTlsSettings
}
}
}
}

0 comments on commit 9a5b636

Please sign in to comment.