Skip to content

Fix WAM broker build on Windows - #1

Merged
tolgaki merged 1 commit into
mainfrom
fix/wam-broker-windows-build
May 1, 2026
Merged

Fix WAM broker build on Windows#1
tolgaki merged 1 commit into
mainfrom
fix/wam-broker-windows-build

Conversation

@tolgaki

@tolgaki tolgaki commented May 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • The broker-wam feature did not compile against windows = 0.58. This PR upgrades to windows = 0.62 + windows-future = 0.3 and corrects three WinRT API mismatches in src/broker/wam.rs.
  • Also fixes a broken doc-test in src/broker/mod.rs that called the async WamBroker::new() without .await and gated only on target_os (not the feature flag).

What was broken

  1. IAsyncOperation<T> was not awaitable. Eight .await sites failed because in windows = 0.58 the Future impl moved out of the main crate. The fix is to depend on windows-future = 0.3, which provides the IntoFuture impl that .await needs.
  2. GetTokenSilentlyAsync(req, account) and FindAllAccountsAsync(provider, client_id) are exposed under their IDL Overload names in the Rust projection — GetTokenSilentlyWithWebAccountAsync and FindAllAccountsWithClientIdAsync respectively.
  3. FindAllAccountsStatus does not exist; the correct enum is FindAllWebAccountsStatus.

Test plan

  • cargo build (default features) — clean.
  • cargo build --features broker-wam — clean, no warnings.
  • cargo test --features broker-wam — 21 lib + 57 integration + 7 doc tests pass.

Out of scope (follow-up)

WAM's AAD plugin scopes account enumeration by package identity, so on an unbundled Win32/CLI binary FindAllAccountsWithClientIdAsync is likely to return NotAllowedByProvider and RequestTokenAsync won't have an HWND to parent its UI to. The proper consumer-side fix is WebAuthenticationCoreManagerInterop::SetWindowForOperation (under Win32_Security_Authentication_Web_Core) — runtime concern, not a build issue, so deferred.

🤖 Generated with Claude Code

…ames

The broker-wam feature did not compile against windows = 0.58. Three
distinct issues:

- IAsyncOperation<T> was not awaitable directly; .await failed at every
  call site. windows-future 0.3 provides the IntoFuture impl needed.
- GetTokenSilentlyAsync(req, account) and FindAllAccountsAsync(provider,
  client_id) are exposed under their IDL Overload names in the Rust
  projection (GetTokenSilentlyWithWebAccountAsync,
  FindAllAccountsWithClientIdAsync).
- FindAllAccountsStatus does not exist; the correct enum is
  FindAllWebAccountsStatus.

Also fixes a broken doc-test in broker/mod.rs that called the async
WamBroker::new() without .await and gated only on target_os without the
feature flag.

Verified on Windows: cargo build, cargo build --features broker-wam,
and cargo test --features broker-wam (21 lib + 57 integration + 7 doc
tests) all pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@tolgaki
tolgaki merged commit 64fe217 into main May 1, 2026
8 of 10 checks passed
@tolgaki
tolgaki deleted the fix/wam-broker-windows-build branch May 1, 2026 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant