Skip to content

Expose MSAL public client builder for embedded WPF sign-in#34

Merged
fw2568 merged 4 commits into
mainfrom
feature/msal-wpf-embedded-signin
Jul 4, 2026
Merged

Expose MSAL public client builder for embedded WPF sign-in#34
fw2568 merged 4 commits into
mainfrom
feature/msal-wpf-embedded-signin

Conversation

@fw2568

@fw2568 fw2568 commented Jul 4, 2026

Copy link
Copy Markdown
Member

Windows desktop apps that want the embedded WebView2 sign-in dialog need the Microsoft.Identity.Client.Desktop package, which this netstandard2.1 library cannot reference. This change exposes the underlying MSAL builder so a consuming app can enable the embedded dialog itself:

  • B2CInteractiveBrowserCredentialOptions.ConfigurePublicClientApplication — an Action<PublicClientApplicationBuilder> invoked just before the client is built, so the consumer can call WithWindowsEmbeddedBrowserSupport().
  • BrowserCustomizationOptions.ParentActivityOrWindow — a Func<IntPtr> applied via WithParentActivityOrWindow(...) so the dialog is shown modally over the application window.

Combined with the existing UseEmbeddedWebView, these drive the embedded flow. Non-Windows callers leave the new options unset and keep using the system browser. Added docs/wpf-embedded-signin.md with the consumer setup and a code sample.

@
Expose MSAL public client builder for embedded WPF sign-in

Windows desktop apps that want the embedded WebView2 sign-in dialog need
the Microsoft.Identity.Client.Desktop package, which this netstandard2.1
library cannot reference. Expose the PublicClientApplicationBuilder via a
ConfigurePublicClientApplication callback on B2CInteractiveBrowserCredentialOptions
so a consuming app can call WithWindowsEmbeddedBrowserSupport(), and add a
ParentActivityOrWindow handle to BrowserCustomizationOptions so the dialog is
shown modally over the application window.
@

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enables Windows desktop consumers (WPF/WinForms) to opt into MSAL’s embedded WebView2 interactive sign-in flow without this netstandard2.1 library directly referencing Microsoft.Identity.Client.Desktop, by exposing the underlying MSAL builder and allowing a parent window handle to be supplied for modal UI ownership.

Changes:

  • Expose an optional ConfigurePublicClientApplication callback so consumers can configure PublicClientApplicationBuilder (e.g., call WithWindowsEmbeddedBrowserSupport() from the Desktop package).
  • Add BrowserCustomizationOptions.ParentActivityOrWindow and apply it via WithParentActivityOrWindow(...) during interactive auth.
  • Add WPF-focused documentation describing the required consumer setup and sample code.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/Eryph.GenePool.Client.Authentication/MsalPublicClient.cs Adds a builder-configuration hook and applies parent-window ownership to interactive auth UI.
src/Eryph.GenePool.Client.Authentication/Credentials/B2CInteractiveBrowserCredentialOptions.cs Introduces ConfigurePublicClientApplication public option with guidance for WebView2 embedded sign-in.
src/Eryph.GenePool.Client.Authentication/Credentials/B2CInteractiveBrowserCredential.cs Wires the new options callback through to the MSAL public client creation.
src/Eryph.GenePool.Client.Authentication/BrowserCustomizationOptions.cs Adds ParentActivityOrWindow option for modal ownership of embedded sign-in UI.
docs/wpf-embedded-signin.md Documents how to enable embedded WebView2 sign-in from a WPF consumer app.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Eryph.GenePool.Client.Authentication/BrowserCustomizationOptions.cs Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Comment thread src/Eryph.GenePool.Client.Authentication/MsalPublicClient.cs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

@fw2568
fw2568 merged commit 9f44f81 into main Jul 4, 2026
5 of 6 checks passed
@fw2568
fw2568 deleted the feature/msal-wpf-embedded-signin branch July 4, 2026 09:57
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.

2 participants