-
-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Extract captcha test and fix empty headers #206
- Loading branch information
Showing
9 changed files
with
45 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
function Test-Captcha { | ||
[CmdletBinding()] | ||
param( | ||
# Response of Invoke-WebRequest | ||
[Parameter( | ||
Mandatory = $true, | ||
ValueFromPipeline = $true | ||
)] | ||
[PSObject]$InputObject | ||
) | ||
|
||
begin { | ||
$tokenRequiresCaptcha = "AUTHENTICATION_DENIED" | ||
$headerRequiresCaptcha = "X-Seraph-LoginReason" | ||
} | ||
|
||
process { | ||
Write-Verbose "[$($MyInvocation.MyCommand.Name)] Status code: $($InputObject.StatusCode)" | ||
Write-Verbose "[$($MyInvocation.MyCommand.Name)] Status code: $($InputObject.StatusCode)" | ||
|
||
if ($InputObject.Headers -and $InputObject.Headers[$headerRequiresCaptcha]) { | ||
if ( ($InputObject.Headers[$headerRequiresCaptcha] -split ",") -contains $tokenRequiresCaptcha ) { | ||
Write-Warning "Confluence requires you to log on to the website before continuing for security reasons." | ||
} | ||
} | ||
} | ||
|
||
end { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters