You are here

protected function SearchApiAcquiaSearchConnection::validResponse in Acquia Search for Search API 7.2

Validate the authenticity of returned data using a nonce and HMAC-SHA1.

Return value

boolean TRUE or FALSE depending on whether the response is valid.

See also

acquia_search_valid_response()

1 call to SearchApiAcquiaSearchConnection::validResponse()
SearchApiAcquiaSearchConnection::authenticateResponse in includes/v2/SearchApiAcquiaSearchConnection.php
Validate the hmac for the response body.

File

includes/v2/SearchApiAcquiaSearchConnection.php, line 155

Class

SearchApiAcquiaSearchConnection
Starting point for the Solr API. Represents a Solr server resource and has methods for pinging, adding, deleting, committing, optimizing and searching.

Code

protected function validResponse($hmac, $nonce, $string, $derived_key = NULL) {
  if (empty($derived_key)) {
    $derived_key = $this
      ->getDerivedKey();
  }
  return $hmac == hash_hmac('sha1', $nonce . $string, $derived_key);
}