Reputation: 21
The application I am performance testing, in jMeter, passes two authentication parameters in the HTTP Header request. The authentication method used is HMAC authentication in JavaScript using jQuery SHA256.
Does anyone have experience / knowledge implementing this in jMeter, or other performance testing tools ?.
Upvotes: 0
Views: 1604
Reputation: 168002
Given you need to send HTTP Request having HMAC-encoded header:
Put the following code into the PreProcessor's "Script" area
import org.apache.commons.codec.digest.HmacUtils;
String key = vars.get("key");
String value = vars.get("value");
String headerValue = HmacUtils.hmacSha256Hex(key, value);
vars.put("headerValue", headerValue);
Configure it to send required header name and use ${headerValue}
as value
vars
shorthand stands forUpvotes: 1