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:
Kevin Yue committed 2026-11-15 21:45:17 +08:00
1 parent 4e6a3ab553
commit 59b8110084
24 files changed
+345 -61

No files matched your search

+33
View File
@@ -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'