Add WithRequestOverMtls() API and E2E test: attested bearer via IMDSv2 mTLS flow - #6086
Merged
Gladwin Johnson VR (gladjohn) merged 10 commits intoAug 7, 2026
Merged
Gladwin Johnson VR (gladjohn) merged 10 commits into
Gladwin Johnson VR (gladjohn) merged 10 commits into
Conversation
Copilot
AI
changed the title
[WIP] Add E2E test for Bearer token fallback on IMDSv2
Add E2E test: ****** when WithMtlsProofOfPossession() is omitted on IMDSv2 host
Jun 23, 2026
Gladwin Johnson VR (gladjohn)
marked this pull request as ready for review
June 23, 2026 18:30
Copilot started reviewing on behalf of
Gladwin Johnson VR (gladjohn)
June 23, 2026 18:30
View session
Gladwin Johnson VR (gladjohn)
marked this pull request as draft
June 23, 2026 18:31
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an end-to-end regression test in the Managed Identity IMDSv2 E2E suite to validate that when .WithMtlsProofOfPossession() is omitted (even if .WithAttestationSupport() is present), MSAL returns a standard Bearer token (no binding certificate) on an IMDSv2-capable host.
Changes:
- Added a new
[DataRow]-driven E2E test covering SAMI and UAMI (clientId) scenarios for the “no mTLS PoP requested” path. - Asserts Bearer token shape (
TokenType == "Bearer",BindingCertificate == null) and that the token was acquired from the identity provider.
Contributor
|
We will need a new Bearer API to support this e2e |
Copilot
AI
changed the title
Add E2E test: Get Bearer when WithMtlsProofOfPossession() is omitted on IMDSv2 host - Still need CVM/TVM + KeyGuard
Add WithMtlsBearerToken() API and E2E test: Get attested ****** via IMDSv2 mTLS flow
Jun 25, 2026
Contributor
|
Copilot resolve conflicts |
This was referenced Sep 13, 2026
Closed
Bump Microsoft.Identity.Client and Microsoft.Identity.Client.Extensions.Msal
teglsbo/DataverseDuck#5
Merged
This was referenced Sep 20, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds a new public API
WithMtlsBearerToken()that uses the full IMDSv2 attested mTLS flow (Credential Guard–issued certificate, mTLS connection to ESTS) but requeststoken_type=bearer, returning a standard bearer token with no binding certificate. Also adds the corresponding E2E test.Changes proposed in this request
WithMtlsBearerToken()extension method toManagedIdentityPopExtensions.cs(Windows-only, mirrorsWithMtlsProofOfPossession()but sendstoken_type=bearerto ESTS instead oftoken_type=mtls_pop)IsMtlsBearerRequestedflag throughAcquireTokenCommonParameters,AcquireTokenForManagedIdentityParameters,AuthenticationRequestParameters,AcquireTokenForManagedIdentityParameterBuilder,ManagedIdentityAuthRequest, andAbstractManagedIdentityManagedIdentityClientto routeIsMtlsBearerRequestedto IMDSv2 (same asIsMtlsPopRequested)ImdsV2ManagedIdentitySource.CreateRequestAsyncto cover both PoP and ****** under a unifiedcredential_guard_not_availableerror codemtls_bearerkey component) to keep them distinct from PoP tokens and plain IMDSv1 bearer tokensPublicAPI.Unshipped.txtfor all target frameworksAcquireToken_OnImdsV2_WithAttestation_NoMtlsPoP_ReturnsBearerE2E test withAcquireToken_OnImdsV2_WithMtlsBearerToken_ReturnsBearer, which calls.WithMtlsBearerToken().WithAttestationSupport()and assertsTokenType == "Bearer",BindingCertificate == null, absence of thecnfclaim in the JWT payload, andTokenSource == IdentityProvidercredential_guard_not_availableTesting
Updated E2E test uses
.WithMtlsBearerToken()and runs on the MSALMSIV2 pool (Credential Guard / VBS enabled). Gracefully marks inconclusive if Credential Guard is unavailable. Unit test for the KeyGuard-not-available error path updated to match the new unified error code.Performance impact
None.
Documentation