public function SearchSubscriber::validateResponse in Acquia Search 2.x
Same name and namespace in other branches
- 3.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 184
Class
- SearchSubscriber
- Extends Solarium plugin: authenticate, etc.
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);
}