[MSI V2 Feature] Adding Credential as a Managed Identity Source #5146
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.
Fixes #5117
Changes proposed in this request
This adds a new credential source to Managed Identity sources. We call it IMDSV2 source.
This pull request introduces significant changes to the Managed Identity authentication flow in the Microsoft Identity Client library. The most important changes include refactoring the
ManagedIdentityAuthRequest
class into an abstract class, adding new classes for handling different Managed Identity sources, and modifying the visibility of theIMsalMtlsHttpClientFactory
interface.Refactoring and new classes:
src/client/Microsoft.Identity.Client/Internal/Requests/ManagedIdentityAuthRequest.cs
: RefactoredManagedIdentityAuthRequest
into an abstract class to support different Managed Identity sources.src/client/Microsoft.Identity.Client/Internal/Requests/CredentialBasedMsiAuthRequest.cs
: AddedCredentialManagedIdentityAuthRequest
class to handle Managed Identity authentication using certificates.src/client/Microsoft.Identity.Client/Internal/Requests/LegacyManagedIdentityAuthRequest.cs
: AddedLegacyManagedIdentityAuthRequest
class to handle legacy Managed Identity authentication.Modifications in existing methods:
src/client/Microsoft.Identity.Client/ApiConfig/Executors/ManagedIdentityExecutor.cs
: UpdatedExecuteAsync
method to determine the Managed Identity source and use the appropriate authentication request class.Visibility changes:
src/client/Microsoft.Identity.Client/AppConfig/IMsalMtlsHttpClientFactory.cs
: Changed the visibility ofIMsalMtlsHttpClientFactory
from internal to public.Testing
tests will be added in a new PR
Performance impact
none
Documentation
Have a separate task for docs