microsoft-authentication-library-for-dotnet
microsoft-authentication-library-for-dotnet copied to clipboard
Add MSI token revocation support for legacy sources
Fixes #5138
Spec: https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/blob/main/docs/msiv1_token_revocation.md
This pull request includes significant changes to the Microsoft.Identity.Client library, focusing on enhancing the handling of managed identity authentication requests. The key changes involve adding support for claims and capabilities, improving token handling logic, and refactoring various classes to accommodate these new features.
Enhancements to Managed Identity Authentication:
-
src/client/Microsoft.Identity.Client/ApiConfig/Parameters/AcquireTokenForManagedIdentityParameters.cs: Added new propertiesClaimsandBadTokenHashto support claims and token hashing. -
src/client/Microsoft.Identity.Client/Internal/Requests/ManagedIdentityAuthRequest.cs: IntroducedICryptographyManagerto compute token hashes and updated theExecuteAsyncmethod to handle claims and token caching more effectively. [1] [2] [3]
Refactoring for Claims and Capabilities:
src/client/Microsoft.Identity.Client/ManagedIdentity/AbstractManagedIdentity.cs: Refactored methods to include claims and capabilities in the managed identity request, including the newApplyClaimsAndCapabilitiesmethod. [1] [2]
Updates to Managed Identity Sources:
- Updated various managed identity source classes (
AppServiceManagedIdentitySource,AzureArcManagedIdentitySource,CloudShellManagedIdentitySource,ImdsManagedIdentitySource,MachineLearningManagedIdentitySource,ServiceFabricManagedIdentitySource) to use the newCreateRequestmethod signature that includesAcquireTokenForManagedIdentityParameters. [1] [2] [3] [4] [5] [6] [7]
These changes collectively improve the robustness and flexibility of managed identity authentication in the Microsoft.Identity.Client library.
Testing unit tests
Performance impact none
Documentation
- [ ] All relevant documentation is updated.
Fixes #5138
Changes proposed in this request This pull request includes several changes to the
Microsoft.Identity.Clientlibrary to support claims and capabilities in managed identity requests. The most important changes involve adding a newClaimsproperty, modifying request creation methods to include this property, and implementing a new method to apply claims and capabilities to requests.Support for Claims and Capabilities:
src/client/Microsoft.Identity.Client/ApiConfig/Parameters/AcquireTokenForManagedIdentityParameters.cs: Added a newClaimsproperty to theAcquireTokenForManagedIdentityParametersclass.src/client/Microsoft.Identity.Client/Internal/Requests/ManagedIdentityAuthRequest.cs: Updated theExecuteAsyncmethod to set theClaimsproperty in_managedIdentityParameters.Request Creation and Handling:
src/client/Microsoft.Identity.Client/ManagedIdentity/AbstractManagedIdentity.cs: Modified theCreateRequestmethod to acceptAcquireTokenForManagedIdentityParametersand added theApplyClaimsAndCapabilitiesmethod to set request parameters based on claims and capabilities. [1] [2] [3]- Updated various managed identity source classes (
AppServiceManagedIdentitySource,AzureArcManagedIdentitySource,CloudShellManagedIdentitySource,ImdsManagedIdentitySource,MachineLearningManagedIdentitySource,ServiceFabricManagedIdentitySource) to use the newCreateRequestmethod signature and apply claims and capabilities. [1] [2] [3] [4] [5] [6]Testing Enhancements:
tests/Microsoft.Identity.Test.Common/Core/Mocks/MockHttpManagerExtensions.cs: Enhanced theAddManagedIdentityMockHandlermethod to include parameters for enabling capabilities and claims, and updated theBuildMockHandlerForManagedIdentitySourcemethod accordingly. [1] [2]Testing unit tests
Performance impact none
Documentation
- [ ] All relevant documentation is updated.
@gladjohn - what's the status on this one - when can it be merged?
@gladjohn - what's the status on this one - when can it be merged?
given that SF is going first, I will create new PR for SF and merge it first.