Repository navigation
feat(msal): read the B2C authority from configuration (backport #3189) - #3190
Merged
Merged
Conversation
PublicClientApplicationOptions can only describe a Microsoft Entra authority: MSAL's ResolveAuthority always types an Instance + TenantId pair as AuthorityType.Aad, so an Azure AD B2C user flow was the one MSAL setting an app could not keep in appsettings and had to hard-code in a Builder(...) callback, per head. - MsalConfiguration.B2CAuthority, applied through WithB2CAuthority right after CreateWithApplicationOptions; the app's Builder(...) still runs last and wins - log the built client's authority at Information, next to the redirect URI, so the effective value is visible without Trace - Given_MsalAuthentication.When_B2CAuthorityConfigured_Then_ClientUsesIt - docs: the B2C section shows the JSON setting; RedirectUri noted as configurable in the WinAppSDK note Motivated by unoplatform/paragon-private#8. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_015CwhNQC1BFcQiymU9GvsP1 (cherry picked from commit 66e8399)
Merged
1 task done
agneszitte
approved these changes
Oct 6, 2026
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.
What
MsalConfigurationgainsB2CAuthority. When set, the provider callsWithB2CAuthorityon thePublicClientApplicationBuilderright afterCreateWithApplicationOptions, before the platform redirect URI and the app'sBuilder(...)callback (which still runs last and wins).Why
MsalConfigurationderives from MSAL'sPublicClientApplicationOptions, soClientId,TenantId,InstanceandRedirectUrialready bind from configuration. The B2C authority did not: MSAL.NET'sResolveAuthorityalways types anInstance+TenantIdpair asAuthorityType.Aad, so a/tfp/user-flow path is only reachable throughWithB2CAuthority. Apps ended up hard-coding it in aBuilder(...)callback per head, which is what unoplatform/paragon-private#8 asks to avoid.Also logs
Using Authority '...'at Information next to the existing redirect URI line, so the effective authority is visible without Trace.Verification
Given_MsalAuthentication.When_B2CAuthorityConfigured_Then_ClientUsesIt(UI.Tests): builds the provider from configuration withB2CAuthorityand the usualTenantId, asserts the built client's authority via the new log line. MSAL keeps a B2C authority unchanged whenTenantIdis also set (B2CAuthority.GetTenantedAuthority), which is the real-app shape.Given_MsalAuthenticationfilter: 20/20 pass locally (Windows,net9.0-desktop), including the 19 pre-existing cases.HowTo-MsalAuthentication.mdupdated;specs/012-msal-auth-fixes/progress.mdaddendum.Backport to
servicing/7.4requested so it ships in the same 7.4.0-dev line as #3188.🤖 Generated with Claude Code
https://claude.ai/code/session_015CwhNQC1BFcQiymU9GvsP1
This is an automatic backport of pull request #3189 done by [Mergify](https://mergify.com).