https://linen.dev logo
#help
Title
# help
o

Orkhan

02/16/2024, 2:54 PM
Hi! I use docker image holomekc/wiremock-gui and I'm trying to get jwt from response, and I have a problem to make it exp time dynamically for every response for example 10 minutes later than now, but there is an issue that it expected static data, is there anyone resolved that kind of issue?
l

Lee Turner

02/16/2024, 3:34 PM
Hi, have you tried the
now
helper?
Copy code
{{now offset='10 minutes'}}
These are documented here - https://wiremock.org/docs/response-templating/#date-and-time-helpers
o

Orkhan

02/18/2024, 6:56 AM
yes, but the problem is inside jwt template for example {{jwt ....}}, it couldn't understand other helpers like random helpers or date and time helpers
l

Lee Turner

02/18/2024, 11:55 AM
Could you share the stubs you are using ?
o

Orkhan

02/18/2024, 1:05 PM
yes sure, { "request": { "urlPathPattern": "/token", "method": "GET" }, "response": { "status": 200, "body": "{\"accessToken\": \"{{jwt algo='HS256' key='my-secret-key' claims='{\"sub\":\"1234567890\",\"iat\":1647190634,\"exp\":1647191234}'}}\"}", "headers": { "Content-Type": "application/json" }, "transformers": [ "response-template" ] } }
I tried to use now format='unix', but it throw exception
l

Lee Turner

02/18/2024, 6:44 PM
Ah, ok I see you are using the jwt helper that comes with the fork of wiremock you are using. I don’t have any experience of using this to be honest as it is custom to the fork you are using. Might be worth asking the maintainer of that fork for help as they might have experience of what you are trying to do - https://github.com/holomekc/wiremock
o

Orkhan

02/19/2024, 6:11 AM
Thank you for your response, I will ask
24 Views