Skip to content

Conversation

@trwalke
Copy link
Member

@trwalke trwalke commented Nov 3, 2025

Fixes #

Changes proposed in this request
Adding Task<bool> ValidateCachedTokenAsync(MsalCacheValidationData) to IAuthenticationOperation2

This method will allow the implementation of IAuthenticationOperation2 (extensions) to validate if the cached token is still valid. If the token is not valid, this will tell MSAL to not use the token and to fetch a new one from ESTS. If the token is valid, MSAL will proceed as normal.

MsalCacheValidationData provides the data to the extension to enable it to determine if the token is valid.

Testing
Unit tests

Performance impact

Documentation

  • All relevant documentation is updated.

@bgavrilMS
Copy link
Member

Not sure what the purpose for this is, but you cannot add a method to an itnerface. See #5376

@trwalke trwalke changed the base branch from main to bogavril/formatResult November 11, 2025 23:26
@trwalke trwalke changed the title Prototype for rejecting MSAL cached token based on AuthOperation Enable IAuthenticationOperation2 to reject MSAL cached tokens and fetch new ones from ESTS Nov 12, 2025
@trwalke trwalke marked this pull request as ready for review November 12, 2025 10:39
@trwalke trwalke requested a review from a team as a code owner November 12, 2025 10:39
Task FormatResultAsync(AuthenticationResult authenticationResult, CancellationToken cancellationToken = default);

/// <summary>
/// Determines whether the cached token is still valid.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/// Determines whether the cached token is still valid.
/// Determines whether the cached token is still valid. Only works for client_credentials flow

@bgavrilMS bgavrilMS merged commit bff5d76 into bogavril/formatResult Nov 13, 2025
3 checks passed
@bgavrilMS bgavrilMS deleted the trwalke/AuthOpUpdate branch November 13, 2025 11:18
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.

4 participants