Add token-acquisition metadata + failure details surface#253
Merged
Conversation
Adds opt-in metadata that lets MISE/IdWeb downstream callers observe how an access token was acquired and why a header-creation attempt failed, without taking a dependency on MSAL.NET internals. New public surface: - TokenAcquisitionMetadata, RegionDetails, TokenAcquisitionFailureDetails (sealed POCOs, init-only) - TokenSource, CacheRefreshReason, CacheLevel, RegionOutcome enums - AcquireTokenResult.Metadata, AuthorizationHeaderInformation.Metadata - AuthorizationHeaderError.Metadata, AuthorizationHeaderError.FailureDetails All members listed in PublicAPI.Unshipped.txt for every target framework. Adds an internal IsExternalInit polyfill so the new init-only setters compile on net462/netstandard2.0/netstandard2.1. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ResponseParameters to AuthorizationHeaderInformation; xmldoc tightening Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
Author
|
@copilot resolve the merge conflicts in this pull request |
Contributor
Resolved in |
bgavrilMS
reviewed
Jun 15, 2026
bgavrilMS
approved these changes
Jun 15, 2026
…l.None semantics MSAL.NET's CacheLevel.None covers any case where the token came from the identity provider rather than a cache tier — cache miss, ForceRefresh, proactive refresh, or cache bypassed. The previous 'cache was not consulted' wording was narrower than the actual semantics flowing in from MSAL via IdWeb. Addresses review comment from @bgavrilMS. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
gladjohn
approved these changes
Jun 16, 2026
trwalke
approved these changes
Jun 16, 2026
Merged
neha-bhargava
added a commit
that referenced
this pull request
Jun 19, 2026
- Bump MicrosoftIdentityAbstractionsVersion 12.1.1 -> 12.2.1 - Add changelog entry (#253 token-acquisition metadata + failure-details surface, #255 AcquireTokenOptions request-message extensions) - Move accumulated public API from Unshipped to Shipped across all target frameworks (#252 UseBoundCredential/ApiUrl/Protocol, #253, #255) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
neha-bhargava
added a commit
that referenced
this pull request
Jun 19, 2026
* Prepare release 12.2.1 - Bump MicrosoftIdentityAbstractionsVersion 12.1.1 -> 12.2.1 - Add changelog entry (#253 token-acquisition metadata + failure-details surface, #255 AcquireTokenOptions request-message extensions) - Move accumulated public API from Unshipped to Shipped across all target frameworks (#252 UseBoundCredential/ApiUrl/Protocol, #253, #255) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Update changelog.md Co-authored-by: Travis Walker <travis.walker@microsoft.com> Signed-off-by: Neha Bhargava <61847233+neha-bhargava@users.noreply.github.com> --------- Signed-off-by: Neha Bhargava <61847233+neha-bhargava@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Travis Walker <travis.walker@microsoft.com>
This was referenced Jun 30, 2026
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.
Summary
Adds a metadata + failure-details surface to
AuthorizationHeaderInformation,AuthorizationHeaderError, andAcquireTokenResultso downstream consumers can observe MSAL-side acquisition diagnostics without bespoke side channels.What's proposed
TokenAcquisitionMetadata— populated by IdWeb fromAuthenticationResult.AuthenticationResultMetadata. CarriesTokenSource,CacheLevel,CacheRefreshReason,RegionDetails, and timing fields (DurationTotalInMs,DurationInHttpInMs,DurationInCacheInMs,RefreshOn,TokenEndpoint).TokenAcquisitionFailureDetails— populated on the failure path. CarriesErrorCode,SubError,StatusCode,Claims,CorrelationId. Field names mirrorMsalServiceExceptionone-to-one so the MSAL → Abstractions copy is identity.AcquiredToken*satellite types —AcquiredTokenSource,AcquiredTokenCacheLevel,AcquiredTokenCacheRefreshReason,AcquiredTokenRegionDetails,AcquiredTokenRegionOutcome. The prefix mirrors the existingAcquireTokenResultand avoids CS0104 source-breaking ambiguity with the identically-named types inMicrosoft.Identity.Client(caught by IdWeb-gate validation).AdditionalResponseParametersmirrored onAuthorizationHeaderInformation(already present onAcquireTokenResult) so consumers can read OAuth extras off the header surface without rehydrating the token result.Metadata/FailureDetailsproperties onAuthorizationHeaderInformation,AuthorizationHeaderError, andAcquireTokenResult({ get; set; }); the nested diagnostics types themselves (TokenAcquisitionMetadata,TokenAcquisitionFailureDetails,AcquiredTokenRegionDetails) are init-only. Additive — existing object-initializer call sites unaffected.IsExternalInitpolyfill added fornet462/net472/netstandard2.0/netstandard2.1(init-only setters not in the BCL on those TFMs).Compatibility
Fully non-breaking on all three axes (binary, source, type-check). 277/277 existing tests pass across net10 / net8 / net462.
References
MISE/docs/design proposal/surface_msal_authentication_result_metadata.md