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

Prasenjit Dutta

06/21/2023, 3:35 PM
Hello All, Can any one please explain, how to add dynamic bearer token in the authorization section? I coud see basic authorization in place in the documentation, does the bearer token works same way? if it is similar to that, how it can be dynamic, with jsonpath? Regards, Prasenjit
b

Bas Dijkstra

06/21/2023, 3:55 PM
What is it exactly that you're looking for? You want to check that an incoming request has an
Authorization
header with a value that matches
Bearer <anything>
, basically? This shouldn't be too hard with a RequestFilter.
p

Prasenjit Dutta

06/21/2023, 5:39 PM
basically wanted to use authoriztion type as bearer token and ten value would be user input
b

Bas Dijkstra

06/21/2023, 8:41 PM
I don’t understand the question. Can you give me an example? The token is sent in the request, that’s the responsibility of the consumer. You’re mocking the provider, so you’re not responsible for creating the token, unless you’re mocking the authentication server?
p

Prasenjit Dutta

06/22/2023, 3:04 AM
Hello Bas, You got it correct, first of all, is authorization the request with bearer token possible in mock? if so, how can it be done? is it the same way as the basic authorization shown in the documentation? Regards,
Well changing my question a bit, I did few hit and trial and looks like authorization doesn't have any impact of the wiremock response till all the headers, urlpath and body data is matching...is that correct understanding? @Oleg Nenashev @Bas Dijkstra
o

Oleg Nenashev

06/22/2023, 6:16 AM
It depends on your configuration. But yes, if there is no token being checked in request filters, the response will be the same
1
p

Prasenjit Dutta

06/22/2023, 4:42 PM
@Oleg Nenashev, thanks for the reply, but I am not able to understand how this Authorizaion (Bearer token) will be checked in the request filter? Can you explain a bit please with an example please
2 Views