public function SearchSubscriber::validateResponse in Acquia Search 3.x
Same name and namespace in other branches
- 2.x src/EventSubscriber/SearchSubscriber.php \Drupal\acquia_search\EventSubscriber\SearchSubscriber::validateResponse()
Validate the authenticity of returned data using a nonce and HMAC-SHA1.
Parameters
string $hmac: HMAC.
string $nonce: Nonce.
string $string: Data string.
string $derived_key: Derived key.
string $env_id: Environment Id.
Return value
bool TRUE if response is valid.
1 call to SearchSubscriber::validateResponse()
- SearchSubscriber::authenticateResponse in src/
EventSubscriber/ SearchSubscriber.php - Validate the hmac for the response body.
File
- src/
EventSubscriber/ SearchSubscriber.php, line 226
Class
- SearchSubscriber
- Class SearchSubscriber.
Namespace
Drupal\acquia_search\EventSubscriberCode
public function validateResponse($hmac, $nonce, $string, $derived_key = NULL, $env_id = NULL) {
if (empty($derived_key)) {
$derived_key = $this
->getDerivedKey($env_id);
}
return $hmac == hash_hmac('sha1', $nonce . $string, $derived_key);
}