Repository navigation
Add OnBeforeAuthHeaderCreation / OnAfterAuthHeaderCreation hooks to DownstreamApi - #3942
Merged
Gladwin Johnson VR (gladjohn) merged 1 commit intoJul 14, 2026
Conversation
Neha Bhargava (neha-bhargava)
force-pushed
the
nebharg/fix-customizerequest-header-ordering
branch
2 times, most recently
from
July 13, 2026 22:07
937c07e to
3150be1
Compare
Bogdan Gavril (bgavrilMS)
approved these changes
Jul 13, 2026
Neha Bhargava (neha-bhargava)
force-pushed
the
nebharg/fix-customizerequest-header-ordering
branch
from
July 13, 2026 22:46
3150be1 to
fc2f715
Compare
Neha Bhargava (neha-bhargava)
force-pushed
the
nebharg/fix-customizerequest-header-ordering
branch
from
July 14, 2026 04:40
fc2f715 to
d39f979
Compare
Neha Bhargava (neha-bhargava)
changed the base branch from
master
to
nebharg/fix-customizehttprequestmessage-regression
July 14, 2026 04:40
Neha Bhargava (neha-bhargava)
force-pushed
the
nebharg/fix-customizerequest-header-ordering
branch
from
July 14, 2026 05:02
d39f979 to
83999d9
Compare
Bogdan Gavril (bgavrilMS)
previously approved these changes
Jul 14, 2026
Base automatically changed from
nebharg/fix-customizehttprequestmessage-regression
to
master
July 14, 2026 10:36
Bogdan Gavril (bgavrilMS)
dismissed
their stale review
July 14, 2026 10:36
The base branch was changed.
Neha Bhargava (neha-bhargava)
force-pushed
the
nebharg/fix-customizerequest-header-ordering
branch
3 times, most recently
from
July 14, 2026 17:18
19da5e1 to
022f5fc
Compare
Bogdan Gavril (bgavrilMS)
approved these changes
Jul 14, 2026
Neha Bhargava (neha-bhargava)
force-pushed
the
nebharg/fix-customizerequest-header-ordering
branch
from
July 14, 2026 17:57
022f5fc to
96929f4
Compare
…ownstreamApi Honor the new AuthorizationHeaderProviderOptions hooks from Microsoft.Identity.Abstractions 12.5.0: - OnBeforeAuthHeaderCreation runs before the authorization header is created and signed, so callers can shape the request that request-binding protocols (SignedHttpRequest q/h/b) sign, ensuring the signature covers the finalized request. - OnAfterAuthHeaderCreation runs after the header is attached. The pre-existing CustomizeHttpRequestMessage is still invoked at the same point for backwards compatibility. Both hooks are propagated through MicrosoftIdentityMessageHandler. Also declare IAuthorizationHeaderProvider2 only on the Base/Default header providers (it already extends IAuthorizationHeaderProvider), and type the Base provider's delegate field as IAuthorizationHeaderProvider2 to avoid upcasting at the metadata delegation sites. Stacked on the regression fix (#3943). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Neha Bhargava (neha-bhargava)
force-pushed
the
nebharg/fix-customizerequest-header-ordering
branch
from
July 14, 2026 22:35
96929f4 to
0517cbb
Compare
Gladwin Johnson VR (gladjohn)
approved these changes
Jul 14, 2026
Travis Walker (trwalke)
approved these changes
Jul 14, 2026
Gladwin Johnson VR (gladjohn)
deleted the
nebharg/fix-customizerequest-header-ordering
branch
July 14, 2026 23:25
This was referenced Jul 17, 2026
Merged
This was referenced Oct 5, 2026
Closed
This was referenced Oct 14, 2026
This was referenced Oct 21, 2026
Closed
Closed
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.
Targets 4.13.2. Builds on the regression fix from #3943 (already merged).
What
Adds explicit request-customization hooks to
DownstreamApi, consuming the newAuthorizationHeaderProviderOptionsmembers fromMicrosoft.Identity.Abstractions12.5.0 (AzureAD/microsoft-identity-abstractions-for-dotnet#262):OnBeforeAuthHeaderCreation— runs before the header is created/signed. Use it to shape the request that a request-binding protocol signs (SignedHttpRequestq/h/b), so the signature covers the finalized request.OnAfterAuthHeaderCreation— runs after the header is attached. The pre-existingCustomizeHttpRequestMessageis still invoked at the same point for backwards compatibility (both run; distinct hooks).Both hooks are propagated through
MicrosoftIdentityMessageHandler.Also
BaseAuthorizationHeaderProviderandDefaultAuthorizationHeaderProviderdeclareIAuthorizationHeaderProvider2only (it already extendsIAuthorizationHeaderProvider), and the Base provider's delegate field is typedIAuthorizationHeaderProvider2to avoid upcasting.Tests
OnBeforeAuthHeaderCreation(asserting it reaches the provider before signing).OnBeforesees no header (runs before);OnAfterandCustomizeHttpRequestMessageboth observe it.with SHR/without SHRtests asserting theAuthorizationheader is created and attached in both cases.Depends on
AzureAD/microsoft-identity-abstractions-for-dotnet#262 (Abstractions 12.5.0) — the Abstractions package floor bump is pending its release.