Skip to content

Add Claims and Capability Support to Managed Identity Flows #3350

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 5, 2025

Conversation

gladjohn
Copy link
Contributor

@gladjohn gladjohn commented May 1, 2025

Add Claims and Capability Support to Managed Identity Flows

  • You've read the Contributor Guide and Code of Conduct.
  • You've included unit or integration tests for your change, where applicable.
  • You've included inline docs for your change, where applicable.
  • There's an open issue for the PR that you are making. If you'd like to propose a new feature or change, please open an issue to discuss the change or find an existing issue.

Summary of the changes (copilot generated)

This pull request introduces several updates to the Microsoft.Identity.Web library, focusing on enabling Continuous Access Evaluation (CAE) for Managed Identity, adding a new test-only interface for custom HTTP client factories, and enhancing token acquisition functionality. Additionally, it includes updates to the solution file and adds a new test application. Below is a summary of the most important changes:

Continuous Access Evaluation (CAE) for Managed Identity

  • Added support for CAE by enabling the cp1 client capability in Managed Identity applications. This includes automatic handling of 401 responses with claims challenges, bypassing the token cache, and retrying the request with a fresh token. [1] [2] [3]
  • Documented the CAE design, configuration, and usage in docs/design/managed_identity_capabilities_devex.md.

New Test-Only Interface for Custom HTTP Client Factories

  • Introduced IManagedIdentityTestHttpClientFactory, an internal interface to allow unit tests to provide custom IMsalHttpClientFactory implementations.
  • Registered the new interface in public API files across multiple target frameworks.

Enhancements to Token Acquisition

  • Updated the TokenAcquisition class to support client capabilities and claims challenges during token acquisition for Managed Identity. [1] [2] [3]
  • Added _miHttpFactory to inject custom HTTP client factories into Managed Identity applications. [1] [2]

Solution File Updates

  • Added a new test application project, daemon-app-msi, to the solution file (Microsoft.Identity.Web.sln). This includes updates to the project list, build configurations, and project dependencies. [1] [2] [3]

New Test Application

  • Added a new test application, daemon-app-msi, to demonstrate token acquisition for Managed Identity and interaction with a downstream API (e.g., Azure Key Vault).

Detail

Fixes #2759650

Fixes #3370

@gladjohn gladjohn force-pushed the gladjohn/puremsi_idweb_tr branch from 544e885 to 797a382 Compare May 1, 2025 14:09
Copy link
Collaborator

@jmprieur jmprieur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to understand first what you are doing and why.
In particular I'm not too keen in adding test features in product code

@gladjohn gladjohn marked this pull request as ready for review May 6, 2025 16:33
@gladjohn gladjohn requested a review from a team as a code owner May 6, 2025 16:33
@gladjohn gladjohn changed the title [DRAFT] Add Claims and Capability Support to Managed Identity Flows Add Claims and Capability Support to Managed Identity Flows May 6, 2025
@gladjohn gladjohn force-pushed the gladjohn/puremsi_idweb_tr branch from 69c1e47 to 8478dd3 Compare May 6, 2025 16:40
@gladjohn
Copy link
Contributor Author

I'd like to understand first what you are doing and why. In particular I'm not too keen in adding test features in product code

@jmprieur this enables us to inject HttpClient into ManagedIdentityApplication, but now this uses DI for the mocks.

@gladjohn gladjohn force-pushed the gladjohn/puremsi_idweb_tr branch 2 times, most recently from f2795da to 4f5cd8d Compare May 21, 2025 19:04
@gladjohn gladjohn requested a review from jmprieur May 22, 2025 20:06
@gladjohn gladjohn force-pushed the gladjohn/puremsi_idweb_tr branch from 19bab4b to ef579b2 Compare May 27, 2025 19:16
Copy link
Collaborator

@jmprieur jmprieur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
once you have addressed at least the namespace.

@gladjohn
Copy link
Contributor Author

gladjohn commented Jun 4, 2025

Thanks @jmprieur @bgavrilMS @jennyf19, just needs one re-approval

@bgavrilMS bgavrilMS merged commit 56765f8 into master Jun 5, 2025
5 checks passed
@bgavrilMS bgavrilMS deleted the gladjohn/puremsi_idweb_tr branch June 5, 2025 10:13
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.

[Feature Request] Add Token Revocation support in pure MSI
5 participants