Skip to content

Adding OBO event to init OBO apis#3724

Merged
trwalke merged 4 commits intomasterfrom
trwalke/AddNewOboEvent
Feb 17, 2026
Merged

Adding OBO event to init OBO apis#3724
trwalke merged 4 commits intomasterfrom
trwalke/AddNewOboEvent

Conversation

@trwalke
Copy link
Copy Markdown
Member

@trwalke trwalke commented Feb 13, 2026

Adding OBO event to init OBO apis
This pull request introduces new extensibility points to the On-Behalf-Of (OBO) authentication flow in Microsoft.Identity.Web, allowing developers to hook into the initialization phase of the OBO process. The changes are applied consistently across all supported target frameworks and involve both new delegate types and methods for synchronous and asynchronous event handling.

The most important changes are:

New OBO Initialization Extension Points:

  • Added new delegates BeforeOnBehalfOfInitialized and BeforeOnBehalfOfInitializedAsync, along with corresponding properties on TokenAcquisitionExtensionOptions (OnBeforeOnBehalfOfInitialized, OnBeforeOnBehalfOfInitializedAsync). These allow custom logic to be executed before the OBO flow is fully initialized.
  • Introduced new virtual Invoke methods for both delegates, supporting both synchronous and asynchronous event handling during OBO initialization.
  • Added new method InvokeOnBeforeOnBehalfOfInitializedAsync to TokenAcquisitionExtensionOptions, enabling asynchronous invocation of the new initialization event.

Integration with OBO Flow:

  • Updated TokenAcquisition.cs to invoke the new OBO initialization event (InvokeOnBeforeOnBehalfOfInitializedAsync) before proceeding with the rest of the OBO authentication process, allowing the token or user information to be modified at this early stage.

Cross-Framework Consistency:

  • All of the above changes are reflected in the public API files for .NET Standard 2.0, .NET 4.6.2, .NET 4.7.2, .NET 8.0, .NET 9.0, and .NET 10.0, ensuring the extensibility points are available across all supported target frameworks. [1] [2]

Minor Codebase Maintenance:

  • Added a missing using System; statement in TokenAcquisitionExtensionOptions.cs to support the new delegate types.

@trwalke trwalke requested a review from a team as a code owner February 13, 2026 07:04
Comment thread src/Microsoft.Identity.Web.TokenAcquisition/TokenAcquisition.cs Outdated
Comment thread src/Microsoft.Identity.Web.TokenAcquisition/TokenAcquisition.cs
@trwalke trwalke merged commit dca1fc0 into master Feb 17, 2026
4 checks passed
@trwalke trwalke deleted the trwalke/AddNewOboEvent branch February 17, 2026 19:24
This was referenced Mar 1, 2026
gunndabad added a commit to DFE-Digital/teaching-record-system that referenced this pull request Mar 27, 2026
#3224)

Updated
[Microsoft.Identity.Web.GraphServiceClientBeta](https://github.com/AzureAD/microsoft-identity-web)
from 4.0.1 to 4.6.0.

<details>
<summary>Release notes</summary>

_Sourced from [Microsoft.Identity.Web.GraphServiceClientBeta's
releases](https://github.com/AzureAD/microsoft-identity-web/releases)._

## 4.6.0

## What's Changed

* Move boilerplate code skills to IdWeb, and add Aspire DevApp
demonstrating Blazor authentication components by @​Copilot in
AzureAD/microsoft-identity-web#3721
* Bump MSAL to 4.83.1 and re-enable Managed Identity CAE tests by
@​Copilot in AzureAD/microsoft-identity-web#3746
* Bump Abstractions to 11.2 by @​bgavrilMS in
AzureAD/microsoft-identity-web#3749
* Update documentation to reference Blazor helpers from
Microsoft.Identity.Web package by @​Copilot in
AzureAD/microsoft-identity-web#3723


**Full Changelog**:
AzureAD/microsoft-identity-web@4.5.0...4.6.0

## 4.4.0

### New features
- Add AOT-compatible web API authentication for .NET 10+. See
[#​3705](AzureAD/microsoft-identity-web#3705)
and
[#​3664](AzureAD/microsoft-identity-web#3664).
- Propagate long-running web API session key back to callers in user
token acquisition. See
[#​3728](AzureAD/microsoft-identity-web#3728).
- Add OBO event initialization for OBO APIs. See
[#​3724](AzureAD/microsoft-identity-web#3724).
- Add support for calling `WithClientClaims` flow for token acquisition.
See
[#​3623](AzureAD/microsoft-identity-web#3623).
- Add `OnBeforeTokenAcquisitionForOnBehalfOf` event. See
[#​3680](AzureAD/microsoft-identity-web#3680).

### Bug fixes
- Throw `InvalidOperationException` with actionable message when a
custom credential is not registered. See
[#​3626](AzureAD/microsoft-identity-web#3626).
- Fix event firing for
`InvokeOnBeforeTokenAcquisitionForOnBehalfOfAsync`. See
[#​3717](AzureAD/microsoft-identity-web#3717).
- Update `OnBeforeTokenAcquisitionForOnBehalfOf` to construct
`ClaimsPrincipal` from token. See
[#​3714](AzureAD/microsoft-identity-web#3714).
- Add a retry counter for acquire token and updated tests with a fake
secret. See
[#​3682](AzureAD/microsoft-identity-web#3682).
- Fix OBO user error handling. See
[#​3712](AzureAD/microsoft-identity-web#3712).
- Fix override merging for app token (and others). See
[#​3644](AzureAD/microsoft-identity-web#3644).
- Fix certificate reload logic to only trigger on certificate-specific
errors. See
[#​3653](AzureAD/microsoft-identity-web#3653).
- Update ROPC flow CCA to pass `SendX5C` to MSAL. See
[#​3671](AzureAD/microsoft-identity-web#3671).

### Dependencies updates
- Bump `qs` in `/tests/DevApps/SidecarAdapter/typescript`. See
[#​3725](AzureAD/microsoft-identity-web#3725).
- Downgrade Microsoft.Extensions.Configuration.Binder to 2.1.0 on .NET
Framework. See
[#​3730](AzureAD/microsoft-identity-web#3730).
- Update .NET SDK to 10.0.103 to address DOTNET-Security-10.0
vulnerability. See
[#​3726](AzureAD/microsoft-identity-web#3726).
- Upgrade to Microsoft.Identity.Abstractions 11 for AoT compatibility.
See
[#​3699](AzureAD/microsoft-identity-web#3699).
- Update to MSAL 4.81.0. See
[#​3665](AzureAD/microsoft-identity-web#3665).

### Documentation
- Add documentation for auto-generated session key for long-running OBO
session. See
[#​3729](AzureAD/microsoft-identity-web#3729).
- Improve the Aspire doc article and skills. See
[#​3695](AzureAD/microsoft-identity-web#3695).
- Add an article and agent skill to add Entra ID to an Aspire app. See
[#​3689](AzureAD/microsoft-identity-web#3689).
- Fix misleading comment in
`CertificatelessOptions.ManagedIdentityClientId`. See
[#​3667](AzureAD/microsoft-identity-web#3667).
- Add Copilot explore tool functionality. See
[#​3694](AzureAD/microsoft-identity-web#3694).

### Fundamentals
- Remove unnecessary warning suppression. See
[#​3715](AzureAD/microsoft-identity-web#3715).
- Migrate labs to Lab.API 2.x (first pass). See
[#​3710](AzureAD/microsoft-identity-web#3710).
- Update Sidecar E2E test constants. See
[#​3693](AzureAD/microsoft-identity-web#3693).
- Fix intermittent failures in `CertificatesObserverTests`. See
[#​3687](AzureAD/microsoft-identity-web#3687).
- Add validation baseline exclusions. See
[#​3684](AzureAD/microsoft-identity-web#3684).
- Add dSTS integration tests. See
[#​3677](AzureAD/microsoft-identity-web#3677).
- Fix FIC test. See
[#​3663](AzureAD/microsoft-identity-web#3663).
- Update IdentityWeb version, build logic, and validation. See
[#​3659](AzureAD/microsoft-identity-web#3659).

### New Contributors
* @​XiaoxinMS2 made their first contribution in
AzureAD/microsoft-identity-web#3677
* @​RyAuld made their first contribution in
AzureAD/microsoft-identity-web#3687
* @​agocke made their first contribution in
AzureAD/microsoft-identity-web#3664
* @​MZOLN made their first contribution in
AzureAD/microsoft-identity-web#3700
* @​christian-posta made their first contribution in
AzureAD/microsoft-identity-web#3644
* @​4gust made their first contribution in
AzureAD/microsoft-identity-web#3682
* @​rayluo made their first contribution in
AzureAD/microsoft-identity-web#3714

## 4.4.0-preview.1

### New features
- Add AOT-compatible web API authentication for .NET 10+. See
[#​3705](AzureAD/microsoft-identity-web#3705)
and
[#​3664](AzureAD/microsoft-identity-web#3664).
- Propagate long-running web API session key back to callers in user
token acquisition. See
[#​3728](AzureAD/microsoft-identity-web#3728).
- Add OBO event initialization for OBO APIs. See
[#​3724](AzureAD/microsoft-identity-web#3724).
- Add support for calling `WithClientClaims` flow for token acquisition.
See
[#​3623](AzureAD/microsoft-identity-web#3623).
- Add `OnBeforeTokenAcquisitionForOnBehalfOf` event. See
[#​3680](AzureAD/microsoft-identity-web#3680).

### Bug fixes
- Throw `InvalidOperationException` with actionable message when a
custom credential is not registered. See
[#​3626](AzureAD/microsoft-identity-web#3626).
- Fix event firing for
`InvokeOnBeforeTokenAcquisitionForOnBehalfOfAsync`. See
[#​3717](AzureAD/microsoft-identity-web#3717).
- Update `OnBeforeTokenAcquisitionForOnBehalfOf` to construct
`ClaimsPrincipal` from token. See
[#​3714](AzureAD/microsoft-identity-web#3714).
- Add a retry counter for acquire token and updated tests with a fake
secret. See
[#​3682](AzureAD/microsoft-identity-web#3682).
- Fix OBO user error handling. See
[#​3712](AzureAD/microsoft-identity-web#3712).
- Fix override merging for app token (and others). See
[#​3644](AzureAD/microsoft-identity-web#3644).
- Fix certificate reload logic to only trigger on certificate-specific
errors. See
[#​3653](AzureAD/microsoft-identity-web#3653).
- Update ROPC flow CCA to pass `SendX5C` to MSAL. See
[#​3671](AzureAD/microsoft-identity-web#3671).

### Dependencies updates
- Bump `qs` in `/tests/DevApps/SidecarAdapter/typescript`. See
[#​3725](AzureAD/microsoft-identity-web#3725).
- Downgrade Microsoft.Extensions.Configuration.Binder to 2.1.0 on .NET
Framework. See
[#​3730](AzureAD/microsoft-identity-web#3730).
- Update .NET SDK to 10.0.103 to address DOTNET-Security-10.0
vulnerability. See
[#​3726](AzureAD/microsoft-identity-web#3726).
- Upgrade to Microsoft.Identity.Abstractions 11 for AoT compatibility.
See
[#​3699](AzureAD/microsoft-identity-web#3699).
- Update to MSAL 4.81.0. See
[#​3665](AzureAD/microsoft-identity-web#3665).

### Documentation
- Add documentation for auto-generated session key for long-running OBO
session. See
[#​3729](AzureAD/microsoft-identity-web#3729).
- Improve the Aspire doc article and skills. See
[#​3695](AzureAD/microsoft-identity-web#3695).
- Add an article and agent skill to add Entra ID to an Aspire app. See
[#​3689](AzureAD/microsoft-identity-web#3689).
- Fix misleading comment in
`CertificatelessOptions.ManagedIdentityClientId`. See
[#​3667](AzureAD/microsoft-identity-web#3667).
- Add Copilot explore tool functionality. See
[#​3694](AzureAD/microsoft-identity-web#3694).

### Fundamentals
- Remove unnecessary warning suppression. See
[#​3715](AzureAD/microsoft-identity-web#3715).
- Migrate labs to Lab.API 2.x (first pass). See
[#​3710](AzureAD/microsoft-identity-web#3710).
- Update Sidecar E2E test constants. See
[#​3693](AzureAD/microsoft-identity-web#3693).
- Fix intermittent failures in `CertificatesObserverTests`. See
[#​3687](AzureAD/microsoft-identity-web#3687).
- Add validation baseline exclusions. See
[#​3684](AzureAD/microsoft-identity-web#3684).
- Add dSTS integration tests. See
[#​3677](AzureAD/microsoft-identity-web#3677).
- Fix FIC test. See
[#​3663](AzureAD/microsoft-identity-web#3663).
- Update IdentityWeb version, build logic, and validation. See
[#​3659](AzureAD/microsoft-identity-web#3659).

## 4.3.0

### New features
- Added token binding (mTLS PoP) scenario for confidential client
(app-only) token acquisition and downstream API calls. See
[#​3622](AzureAD/microsoft-identity-web#3622).

### Dependencies updates
- Bumped **qs** from 6.14.0 to 6.14.1 in
/tests/DevApps/SidecarAdapter/typescript. See [#​3660](
AzureAD/microsoft-identity-web#3660).

### Documentation
- Modernized Identity Web documentation, which is now can be found in
[docs](https://github.com/AzureAD/microsoft-identity-web/tree/master/docs).
See
[#​3566](AzureAD/microsoft-identity-web#3566).
- Added token binding (mTLS PoP) documentation. See
[#​3661](AzureAD/microsoft-identity-web#3661).

## 4.2.0

# What's Changed

## New features

- Added CAE claims support for FIC + Managed Identity. See #​3647 for
details.
- Added AddMicrosoftIdentityMessageHandler extension methods for
IHttpClientBuilder. See #​3649 for details.

## Bug fixes


- Fixed tenant not being propagated in credential FIC acquisition. See
#​3633 for details.
- Fixed ForAgentIdentity hardcoded 'AzureAd' ConfigurationSection to
respect AuthenticationOptionsName. See #​3635 for details.
- Fixed GetTokenAcquirer to propagate MicrosoftEntraApplicationOptions
properties. See #​3651 for details.
- Added meaningful error message when identity configuration is missing.
See #​3637 for details.

## Dependencies updates

- Update Microsoft.Identity.Abstractions to version 10.0.0.
- Bump express from 5.1.0 to 5.2.0 in
/tests/DevApps/SidecarAdapter/typescript. #​3636
- Bump jws from 3.2.2 to 3.2.3 in
/tests/DevApps/SidecarAdapter/typescript. #​3641

## Fundamentals

- Update support policy. #​3656
- Update agent identity coordinates in E2E tests after deauth. #​3640
- Update E2E agent identity configuration to new tenant. #​3646


**Full Changelog**:
AzureAD/microsoft-identity-web@4.1.1...4.2.0

## 4.1.1

### Bug fixes
- Authority-only configuration parsing improvements: Early parsing of
Authority into Instance/TenantId and defensive fallback in
PrepareAuthorityInstanceForMsal. Behavior is backward compatible;
Authority is still ignored when Instance/TenantId explicitly
provided—now surfaced via a warning. See
[#​3612](AzureAD/microsoft-identity-web#3612).

### New features
- Added warning diagnostics for conflicting Authority vs
Instance/TenantId: Emitting a single structured warning when both styles
are provided. See
[#​3611](AzureAD/microsoft-identity-web#3611).

### Fundamentals
- Expanded authority test matrix: Coverage for AAD (v1/v2), B2C (/tfp/
normalization, policy path), CIAM (PreserveAuthority), query parameters,
scheme-less forms, and conflict scenarios. See
[#​3610](AzureAD/microsoft-identity-web#3610).

## 4.1.0

### New features
- Migrate to .NET 10 GA.
[#​3449](AzureAD/microsoft-identity-web#3449)
and
[#​3590](AzureAD/microsoft-identity-web#3590)

### Dependencies updates
- Bump MSAL.NET to version
[4.79.2](https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/releases/tag/4.79.2)
and handle changes to deprecated WithExtraQueryParameters APIs.
[#​3583](AzureAD/microsoft-identity-web#3583)
- Update Microsoft.IdentityModel and Abstractions versions.
[#​3604](AzureAD/microsoft-identity-web#3604)
- Update coverlet.collector to 6.0.4.
[#​3587](AzureAD/microsoft-identity-web#3587)
- Update package validation baseline version to 4.0.0.
[#​3589](AzureAD/microsoft-identity-web#3589)
- Bump js-yaml from 4.1.0 to 4.1.1 in
/tests/DevApps/SidecarAdapter/typescript.
[#​3595](AzureAD/microsoft-identity-web#3595)

### Entra ID SDK sidecar
- Restrict hosts to localhost for sidecar.
[#​3579](AzureAD/microsoft-identity-web#3579)
- Update http file to match endpoints.
[#​3555](AzureAD/microsoft-identity-web#3555)
- Revise sidecar issue template for Entra ID.
[#​3577](AzureAD/microsoft-identity-web#3577)

### Documentation
- Update README to include Entra SDK container info.
[#​3578](AzureAD/microsoft-identity-web#3578)

### Fundamentals
- Include NET 9.0 in template-install-dependencies.
[#​3593](AzureAD/microsoft-identity-web#3593)
- Fix CodeQL alerts.
[#​3591](AzureAD/microsoft-identity-web#3591)
- Suppression file is needed.
[#​3592](AzureAD/microsoft-identity-web#3592)

Commits viewable in [compare
view](AzureAD/microsoft-identity-web@4.0.1...4.6.0).
</details>

[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=Microsoft.Identity.Web.GraphServiceClientBeta&package-manager=nuget&previous-version=4.0.1&new-version=4.6.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: James Gunn <james@gunn.io>
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.

3 participants