Skip to content

Add GetAuthorizationHeaderProvider2() to OWIN controllers#3928

Merged
neha-bhargava merged 2 commits into
nebharg/register-iauthorizationheaderprovider2from
nebharg/owin-getauthorizationheaderprovider2
Jul 7, 2026
Merged

Add GetAuthorizationHeaderProvider2() to OWIN controllers#3928
neha-bhargava merged 2 commits into
nebharg/register-iauthorizationheaderprovider2from
nebharg/owin-getauthorizationheaderprovider2

Conversation

@neha-bhargava

Copy link
Copy Markdown
Contributor

OWIN controllers already have a one-liner for the v1 IAuthorizationHeaderProvider. This adds the same convenience for IAuthorizationHeaderProvider2 on both ApiController and ControllerBase, resolving it from the OWIN TokenAcquirerFactory service provider (same pattern/error message as the v1 helper).

Depends on #3927 (which registers IAuthorizationHeaderProvider2 in DI) - stacked on that branch, so please review it after #3927. Opening separately for team discussion on whether we want the OWIN convenience overload.

neha-bhargava and others added 2 commits July 6, 2026 12:09
DefaultAuthorizationHeaderProvider implements both IAuthorizationHeaderProvider and
IAuthorizationHeaderProvider2, but only v1 was registered - so resolving v2 directly
returned nothing (internal callers only worked because they cast). Register v2 as the
same instance (mirroring how ITokenAcquisitionInternal is exposed off ITokenAcquisition)
in both the singleton and scoped paths, and remove it on the lifetime-mismatch re-registration.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
OWIN controllers already get a one-liner for the v1 IAuthorizationHeaderProvider;
this adds the same convenience for IAuthorizationHeaderProvider2 on both ApiController
and ControllerBase, resolving it from the OWIN TokenAcquirerFactory service provider.

Depends on IAuthorizationHeaderProvider2 being registered in DI.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@neha-bhargava
neha-bhargava requested a review from a team as a code owner July 6, 2026 20:25
@bgavrilMS
bgavrilMS force-pushed the nebharg/register-iauthorizationheaderprovider2 branch from 62f62ca to e31076a Compare July 7, 2026 11:20
@neha-bhargava
neha-bhargava merged commit 2ef4570 into nebharg/register-iauthorizationheaderprovider2 Jul 7, 2026
1 check passed
@neha-bhargava
neha-bhargava deleted the nebharg/owin-getauthorizationheaderprovider2 branch July 7, 2026 16:52
neha-bhargava added a commit that referenced this pull request Jul 7, 2026
* Register IAuthorizationHeaderProvider2 in DI

DefaultAuthorizationHeaderProvider implements both IAuthorizationHeaderProvider and
IAuthorizationHeaderProvider2, but only v1 was registered - so resolving v2 directly
returned nothing (internal callers only worked because they cast). Register v2 as the
same instance (mirroring how ITokenAcquisitionInternal is exposed off ITokenAcquisition)
in both the singleton and scoped paths, and remove it on the lifetime-mismatch re-registration.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Add GetAuthorizationHeaderProvider2() to OWIN controllers (#3928)

* Register IAuthorizationHeaderProvider2 in DI

DefaultAuthorizationHeaderProvider implements both IAuthorizationHeaderProvider and
IAuthorizationHeaderProvider2, but only v1 was registered - so resolving v2 directly
returned nothing (internal callers only worked because they cast). Register v2 as the
same instance (mirroring how ITokenAcquisitionInternal is exposed off ITokenAcquisition)
in both the singleton and scoped paths, and remove it on the lifetime-mismatch re-registration.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Add GetAuthorizationHeaderProvider2() to OWIN controllers

OWIN controllers already get a one-liner for the v1 IAuthorizationHeaderProvider;
this adds the same convenience for IAuthorizationHeaderProvider2 on both ApiController
and ControllerBase, resolving it from the OWIN TokenAcquirerFactory service provider.

Depends on IAuthorizationHeaderProvider2 being registered in DI.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
neha-bhargava added a commit that referenced this pull request Jul 10, 2026
Add the 4.13.0 changelog section (OWIN GetAuthorizationHeaderProvider2 #3928, IAuthorizationHeaderProvider2 DI registration #3927, MSAL 4.86.0 bump #3931), move the OWIN unshipped public API entries to shipped, and bump the dev version to 4.13.1.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
iarekk added a commit that referenced this pull request Jul 13, 2026
Add the 4.13.0 changelog section (OWIN GetAuthorizationHeaderProvider2 #3928, IAuthorizationHeaderProvider2 DI registration #3927, MSAL 4.86.0 bump #3931), move the OWIN unshipped public API entries to shipped, and bump the dev version to 4.13.1.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Iarek Kovtunenko <16271112+iarekk@users.noreply.github.com>
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.

4 participants