In my request body I have property field names with "_"
So I used @JsonProperty
and mapped to camelCase names.
But the problem is I need to authenticate the request based on the hashed string value coming in header. This the initial request hash sha512 with a key.
But in my case since I used @JsonProperty
, a field for which initial name is currency_received
is deserialized to currencyReceived
@JsonProperty("currency_received")
private CurrencyReceived currencyReceived;
And I try to get the hashed value of request using
String reqObj = gson.toJson(req);
String hashVal = HashGeneratorUtils.generateHmacSHA512(reqObj, pvt_key);
the hashVal
will never be same as the value coming in header hashed with original request.
So, what is the ideal way to solve this problem.