How to handle authorization token in encrypted response body and pass that token to the subsequent requests in JMeter

47 Views Asked by At

handle authorization token in encrypted response body and passed to the subsequent requests

encrypted data in response body decrypted using the code send by the developer , in that decrypted body authorization token that we need to handle and stored inside a variable and pass to the next requests.

2

There are 2 best solutions below

1
chandrabhusan On

I resolved the issue by my own. -->First I store the encrypted response body in variable using regular expression extractor --->Then I used beanshell preprocessor and call the variable which includes encrypted response body and decrypted it using the code send by the developer and stores that decrypted data in variable --->copy that variable in dummy sampler response body --->Now I used the regular expression extractor and extract the AUTH token and saved in variable and passed it to the subsequent requests.

0
Dmitri T On

You can perform decryption using JSR223 PostProcessor and Groovy language.

Response body can be accessed like:

String body  = prev.getResponseDataAsString()

once you do the decryption you can either substitute original encrypted response with the decrypted response like:

prev.setResponseData('decrypted-response-here', 'UTF-8')

or save it into a JMeter Variable like:

vars.put('decrypted-response, your-decrypted-response)

More information on what do these vars and prev mean: Top 8 JMeter Java Classes You Should Be Using with Groovy

You may also find Encryption and decryption with Groovy blog post useful