we’re trying to speed up some integration tests (NET8) by jumping into the future (by using our IClock abstraction).
This by itself works fine, but after creating a new jwt token, which also has correct timestamps, the verification fails with www-authenticate: Bearer error="invalid_token",error_description="The token is not valid before '07/26/2024 17:56:05'"
.
So it looks like the Auth Middleware is still using system time. Which is kind of odd because we passed our timeprovider to AddJwtBearer:
services.AddSingleton<IClock>(ClockMutable.Default);
services
.AddAuthentication()
.AddJwtBearer(AuthenticationSchemes.Default, c => {
...
c.TimeProvider = ClockMutable.Default;
...
});
Also none of the properties by the ClockMutable.Default
instance are called.
What do I need to do so AddJwtBearer uses the provided TimeProvider?