mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2026-11-18 22:16:18 -05:00
fix(windows): refine authentication UI and rotate desktop logs
Brand browser callbacks as GP Connect Login and refine the native recovery controls. Share bounded rotating logs between the GUI and authentication helper. Make OpenSSL interoperability tests opt-in, retain them in full CI, and correct platform-specific test guards and dependencies.
This commit is contained in:
23 files changed
+344
-60
No files matched your search
@@ -60,6 +60,6 @@ run_stage 'Frontend tests' 5m \
|
||||
run_stage 'Frontend build' 10m \
|
||||
docker exec --workdir "$workspace" "$container" pnpm --filter gpgui build
|
||||
run_stage 'Compile Rust tests' 30m \
|
||||
docker exec --workdir "$workspace" "$container" cargo test --workspace --locked --no-run
|
||||
docker exec --workdir "$workspace" "$container" cargo test --workspace --locked --features gpapi/openssl-tests --no-run
|
||||
run_stage 'Rust tests' 10m \
|
||||
docker exec --workdir "$workspace" "$container" cargo test --workspace --locked
|
||||
docker exec --workdir "$workspace" "$container" cargo test --workspace --locked --features gpapi/openssl-tests
|
||||
@@ -1,4 +1,5 @@
|
||||
# Run in an unlocked Windows desktop. Start windows-webview-server.py first.
|
||||
# Use a GUI-subsystem binary; ordinary debug builds intentionally open a console.
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory)][string]$Binary,
|
||||
@@ -10,13 +11,29 @@ Add-Type -AssemblyName UIAutomationClient
|
||||
Add-Type -AssemblyName UIAutomationTypes
|
||||
Add-Type @'
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
public class GPWebviewFixture {
|
||||
[StructLayout(LayoutKind.Sequential)] public struct POINT { public int X, Y; }
|
||||
[DllImport("user32.dll")] public static extern bool PostMessage(IntPtr h, uint m, IntPtr w, IntPtr l);
|
||||
[DllImport("user32.dll")] public static extern IntPtr WindowFromPoint(POINT p);
|
||||
[DllImport("user32.dll")] public static extern bool SetWindowPos(IntPtr h, IntPtr after, int x, int y, int w, int height, uint flags);
|
||||
[DllImport("user32.dll")] public static extern bool SetForegroundWindow(IntPtr h);
|
||||
delegate bool WindowCallback(IntPtr h, IntPtr l);
|
||||
[DllImport("user32.dll")] static extern bool EnumWindows(WindowCallback callback, IntPtr l);
|
||||
[DllImport("user32.dll")] static extern bool IsWindowVisible(IntPtr h);
|
||||
[DllImport("user32.dll", CharSet = CharSet.Unicode)] static extern int GetClassName(IntPtr h, StringBuilder name, int length);
|
||||
public static long[] ConsoleWindows() {
|
||||
var windows = new List<long>();
|
||||
EnumWindows((h, l) => {
|
||||
var name = new StringBuilder(256);
|
||||
GetClassName(h, name, name.Capacity);
|
||||
if (IsWindowVisible(h) && (name.ToString() == "ConsoleWindowClass" || name.ToString() == "CASCADIA_HOSTING_WINDOW_CLASS")) windows.Add(h.ToInt64());
|
||||
return true;
|
||||
}, IntPtr.Zero);
|
||||
return windows.ToArray();
|
||||
}
|
||||
}
|
||||
'@
|
||||
$work = Join-Path $env:TEMP ('gp-webview-test-' + [Guid]::NewGuid().ToString('N'))
|
||||
@@ -31,8 +48,19 @@ function Start-Auth([string]$Request, [string[]]$Extra = @()) {
|
||||
$script:stdout = Join-Path $work "$script:index.json"
|
||||
$script:stderr = Join-Path $work "$script:index.log"
|
||||
$arguments = @($FixtureUrl, '--saml-request', ('"' + $Request + '"'), '--window-title', '"GP Auth Fixture"', '--os', 'Windows') + $Extra
|
||||
$consoles = @([GPWebviewFixture]::ConsoleWindows())
|
||||
$script:current = Start-Process -FilePath $Binary -ArgumentList $arguments -PassThru -RedirectStandardOutput $script:stdout -RedirectStandardError $script:stderr
|
||||
$null = $script:current.Handle
|
||||
# Watch startup: device-information commands finish before the sign-in window appears.
|
||||
$deadline = [DateTime]::UtcNow.AddSeconds(15)
|
||||
do {
|
||||
foreach ($console in [GPWebviewFixture]::ConsoleWindows()) {
|
||||
if ($console -notin $consoles) { throw "Authentication opened a console in case $script:index" }
|
||||
}
|
||||
if ($script:current.HasExited -or $script:current.MainWindowHandle -ne [IntPtr]::Zero) { break }
|
||||
Start-Sleep -Milliseconds 20
|
||||
$script:current.Refresh()
|
||||
} while ([DateTime]::UtcNow -lt $deadline)
|
||||
}
|
||||
function Finish-Auth([bool]$Success) {
|
||||
if (!$script:current.WaitForExit(20000)) { throw "Authentication timed out in case $script:index" }
|
||||
@@ -128,6 +156,11 @@ try {
|
||||
Invoke-Control 'Cancel'
|
||||
Finish-Auth $false
|
||||
'PASS: rejected sign-in recovery'
|
||||
Start-Auth ($FixtureUrl + '/missing')
|
||||
$null = Wait-Control ('Couldn' + [char]0x2019 + 't load sign-in.')
|
||||
Invoke-Control 'Try Again'
|
||||
Finish-Auth $true
|
||||
'PASS: initial page-load failure and fresh-prelogin retry'
|
||||
Start-Auth ($FixtureUrl + '/temporary')
|
||||
Finish-Auth $true
|
||||
'PASS: automatic fresh-prelogin recovery'
|
||||
|
||||
Reference in new issue
Block a user