Add OnBeforeAuthHeaderCreation / OnAfterAuthHeaderCreation hooks#262
Merged
Merged
Conversation
neha-bhargava
force-pushed
the
nebharg/onbefore-onafter-authheader-hooks
branch
from
July 13, 2026 22:45
5facbb8 to
0285bfd
Compare
neha-bhargava
force-pushed
the
nebharg/onbefore-onafter-authheader-hooks
branch
3 times, most recently
from
July 14, 2026 17:39
cb77f72 to
dc8b4ca
Compare
Avery-Dunn
reviewed
Jul 14, 2026
Avery-Dunn
approved these changes
Jul 14, 2026
Add two Action<HttpRequestMessage>? hooks to AuthorizationHeaderProviderOptions: - OnBeforeAuthHeaderCreation runs before the authorization header is created, so callers can shape the request that a request-binding protocol signs (for example a SignedHttpRequest binding the query, headers, or body via the q/h/b claims), ensuring the signature covers the finalized request. - OnAfterAuthHeaderCreation runs after the header (including Authorization) is set, just before the message is sent. Symmetric with the before hook; shares timing with the existing CustomizeHttpRequestMessage (backwards compatible). Both are copied by the copy constructor. Additive and non-breaking. Version bump and changelog are left for the post-release PR. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
neha-bhargava
force-pushed
the
nebharg/onbefore-onafter-authheader-hooks
branch
from
July 14, 2026 18:29
dc8b4ca to
9391631
Compare
Avery-Dunn
approved these changes
Jul 14, 2026
gladjohn
approved these changes
Jul 14, 2026
Merged
neha-bhargava
added a commit
that referenced
this pull request
Jul 14, 2026
Document the 12.5.0 changelog section (OnBeforeAuthHeaderCreation / OnAfterAuthHeaderCreation hooks, #262), move those unshipped public API entries to shipped, and bump the dev version to 12.5.1. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.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.
What
Adds two
Action<HttpRequestMessage>?hooks toAuthorizationHeaderProviderOptions, giving callers explicit, self-documenting control over request customization relative to authorization-header creation:OnBeforeAuthHeaderCreation— runs before the header is created. TheAuthorizationheader is not yet present. Use it to shape the request that a request-binding protocol signs — e.g. a SignedHttpRequest that binds the query, headers, or body (q/h/bclaims) to the token — so the signature covers the finalized request.OnAfterAuthHeaderCreation— runs after the header (includingAuthorization) is set, just before the message is sent. Use it to observe or adjust the finalized request. Same timing as the existingCustomizeHttpRequestMessage.Why
CustomizeHttpRequestMessageis documented to run after the header, but the request-binding (SHRq/h/b) work needs a before hook. Rather than overload one callback with ambiguous timing, this adds an explicit before/after pair; the timing is encoded in the name.Notes
CustomizeHttpRequestMessagebehavior is unchanged.PublicAPI.Unshipped.txtupdated across all 6 TFMs; version bumped to 12.5.0.DownstreamApi) in a companion PR.