Skip to content

Commit

Permalink
[Fix]: Fix authentication method in Set-PSWinBGPConfig (#12)
Browse files Browse the repository at this point in the history
* Fix authentication method in Set-PSWinBGPConfig
  • Loading branch information
webalexeu authored Nov 4, 2024
1 parent f08cded commit 6e352de
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
16 changes: 8 additions & 8 deletions src/data/PSWinBGP.psd1
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
@{
LocalhostApiPort = 8888
LocalhostApiProtocol = 'http'
LocalhostApiTimeout = 5
LocalhostAuthenticationMethod = 'Anonymous'
ApiPort = 8888
ApiProtocol = 'https'
ApiTimeout = 10
AuthenticationMethod = 'IntegratedWindowsAuthentication'
LocalhostApiAuthenticationMethod = 'Anonymous'
LocalhostApiPort = 8888
LocalhostApiProtocol = 'http'
LocalhostApiTimeout = 5
ApiAuthenticationMethod = 'IntegratedWindowsAuthentication'
ApiPort = 8888
ApiProtocol = 'https'
ApiTimeout = 10
}
4 changes: 2 additions & 2 deletions src/functions/private/Invoke-PSWinBGP.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ function Invoke-PSWinBGP() {
}
} else {
if ($ComputerName -eq 'localhost') {
[String]$AuthenticationMethod = $Script:PSWinBGP.LocalhostApiAuthenticationMethod
[Int]$Port = $Script:PSWinBGP.LocalhostApiPort
[String]$Protocol = $Script:PSWinBGP.LocalhostApiProtocol
[Int]$Timeout = $Script:PSWinBGP.LocalhostApiTimeout
[String]$AuthenticationMethod = $Script:PSWinBGP.LocalhostAuthenticationMethod
} else {
[String]$AuthenticationMethod = $Script:PSWinBGP.ApiAuthenticationMethod
[Int]$Port = $Script:PSWinBGP.ApiPort
[String]$Protocol = $Script:PSWinBGP.ApiProtocol
[Int]$Timeout = $Script:PSWinBGP.ApiTimeout
[String]$AuthenticationMethod = $Script:PSWinBGP.AuthenticationMethod
}

# Initialize output variable
Expand Down
10 changes: 10 additions & 0 deletions src/functions/public/Set-PSWinBGPConfig.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ function Set-PSWinBGPConfig {
.DESCRIPTION
Set PSWinBBGP module configuration, and $PSWinBBGP module variable.
.PARAMETER ApiAuthenticationMethod
API Authentication Method (Default: IntegratedWindowsAuthentication)
.PARAMETER ApiPort
API Port (Default: 8888)
Expand All @@ -15,6 +18,9 @@ function Set-PSWinBGPConfig {
.PARAMETER ApiTimeout
API Timeout (Default: 10s)
.PARAMETER LocalhostApiAuthenticationMethod
Localhost API Authentication Method (Default: Anonymous)
.PARAMETER LocalhostApiPort
Localhost API Port (Default: 8888)
Expand All @@ -26,19 +32,23 @@ function Set-PSWinBGPConfig {
#>
[CmdletBinding(SupportsShouldProcess = $true)]
param(
[string]$ApiAuthenticationMethod,
[Int]$ApiPort,
[string]$ApiProtocol,
[Int]$ApiTimeout,
[string]$LocalhostApiAuthenticationMethod,
[Int]$LocalhostApiPort,
[string]$LocalhostApiProtocol,
[Int]$LocalhostApiTimeout
)

if ($pscmdlet.ShouldProcess('$Script:PSWinBGP', 'Set config')) {
switch ($PSBoundParameters.Keys) {
'ApiAuthenticationMethod' { $Script:PSWinBGP.ApiAuthenticationMethod = $ApiAuthenticationMethod }
'ApiPort' { $Script:PSWinBGP.ApiPort = $ApiPort }
'ApiProtocol' { $Script:PSWinBGP.ApiProtocol = $ApiProtocol }
'ApiTimeout' { $Script:PSWinBGP.ApiTimeout = $ApiTimeout }
'LocalhostApiAuthenticationMethod' { $Script:PSWinBGP.LocalhostApiAuthenticationMethod = $LocalhostApiAuthenticationMethod }
'LocalhostApiPort' { $Script:PSWinBGP.LocalhostApiPort = $LocalhostApiPort }
'LocalhostApiProtocol' { $Script:PSWinBGP.LocalhostApiProtocol = $LocalhostApiProtocol }
'LocalhostApiTimeout' { $Script:PSWinBGP.LocalhostApiTimeout = $LocalhostApiTimeout }
Expand Down

0 comments on commit 6e352de

Please sign in to comment.