Fix WAM broker build on Windows - #1
Merged
Merged
Conversation
…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>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
broker-wamfeature did not compile againstwindows = 0.58. This PR upgrades towindows = 0.62+windows-future = 0.3and corrects three WinRT API mismatches insrc/broker/wam.rs.src/broker/mod.rsthat called the asyncWamBroker::new()without.awaitand gated only ontarget_os(not the feature flag).What was broken
IAsyncOperation<T>was not awaitable. Eight.awaitsites failed because inwindows = 0.58theFutureimpl moved out of the main crate. The fix is to depend onwindows-future = 0.3, which provides theIntoFutureimpl that.awaitneeds.GetTokenSilentlyAsync(req, account)andFindAllAccountsAsync(provider, client_id)are exposed under their IDLOverloadnames in the Rust projection —GetTokenSilentlyWithWebAccountAsyncandFindAllAccountsWithClientIdAsyncrespectively.FindAllAccountsStatusdoes not exist; the correct enum isFindAllWebAccountsStatus.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
FindAllAccountsWithClientIdAsyncis likely to returnNotAllowedByProviderandRequestTokenAsyncwon't have an HWND to parent its UI to. The proper consumer-side fix isWebAuthenticationCoreManagerInterop::SetWindowForOperation(underWin32_Security_Authentication_Web_Core) — runtime concern, not a build issue, so deferred.🤖 Generated with Claude Code