Relative Content

Tag Archive for asp.net-coreauthenticationtestingtimejwt

Asp Core AddJwtBearer TimeProvider: TimeTravel proof Token Verification

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: