Use TimeProvider instead of DateTime ambient context #2572
Labels
Customer reported
Indicates issue was opened by customer
Enhancement
The issue is a new feature
Fundamentals
Currently, token lifetime validation is performed by getting the current time from a DateTime ambient context, as seen here.
(I know there's other places where DateTime is used to get the current time, this is just an example)
This leads to flaky, non-deterministic tests, as there's no control of the current time whatsoever.
With the introduction of TimeProvider in .NET 8, there's an out-of-the-box solution for abstracting time.
My proposal here is adopt TimeProvider instead of relying directly on static DateTime class.
The text was updated successfully, but these errors were encountered: