Hello there,
Problem
I need to set / mock the actual evaluation time for creating and verifying a JWT.
Why
we use quarkus / smallrye JWT in our project. I want to write end-to-end tests for the application.
One whole scenario is: handling expired JWT tokens.
Our gherkin test looks somehow like this:
Scenario: expired JWT cookies lead to 401 page
Given now is "2023-12-13T12:00:00+01:00"
And I am authenticated as admin
When now is "2023-12-23T12:00:00+01:00"
And I browse the URL "/admin/dashboard"
Then the status code must be 401
My solution idea
I've looked up the code, and there is an extension point in jose that allows you to set a static evaluation time
org.jose4j.jwt.consumer.JwtConsumerBuilder#setEvaluationTime
That could be exposed in smallrye-jwt via configuration or CDI extension point.
What do you think? Is this somehow possible already and I just haven't found a doc for that?
Any help would be nice :)
Thank you + cheers