connectors icon indicating copy to clipboard operation
connectors copied to clipboard

Update JWTToklen in JWTAuthHandlerTest

Open vringar opened this issue 3 months ago • 4 comments

Describe the Bug

The token is currently expired and causing test failures

Steps to Reproduce

  1. Run this test

Expected Behavior

The test should be passing

vringar avatar Nov 14 '25 13:11 vringar

Okay, what I've found so far: Copying the two comment blocks into files and then running npx jwt-gen-cli -f /tmp/payload.json -e 5y -a none -s /tmp/secret.json after deleting the "exp": 1786822616, from the payload.json

However, this just pushes the problem "down the line" as eventually our tests will break again. This leaves me with two considerations:

  1. Freeze the test time somewhere in the past, so that the valid tokens never expire
  2. Push the expiration dates on valid token like 15 years into the future and also link to this issue with instructions

vringar avatar Nov 14 '25 16:11 vringar

Another thing that the exception is: com.auth0.jwt.exceptions.TokenExpiredException: The Token has expired on 2025-01-13T11:16:38Z. So why were the tests passing until pretty much exactly 10 months later?

vringar avatar Nov 14 '25 16:11 vringar

Also the token named NO_ALG_PRESENT_JWT uses the RS256 apparently even from a real system because there is mention of https://sts.windows.net/8ebe249d-8312-4ffb-9b6b-08e56669d578/ as the idp

vringar avatar Nov 14 '25 16:11 vringar

Okay, jwt-gen-cli just doesn't support JWK, so it's not parsing the JSON to retrieve the private key components. Maybe this needs to be a little Java programm that consumes the JWK and uses the private key portions of it to create a new valid token

vringar avatar Nov 14 '25 17:11 vringar

@vringar PTAL whether this fixes your issue: https://github.com/camunda/connectors/pull/5830

sbuettner avatar Nov 27 '25 17:11 sbuettner

The tests are passing again, so closing this for now

vringar avatar Dec 01 '25 14:12 vringar