You are here

public function SearchSubscriber::validateResponse in Acquia Connector 8

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 acquia_search/src/EventSubscriber/SearchSubscriber.php
Validate the hmac for the response body.

File

acquia_search/src/EventSubscriber/SearchSubscriber.php, line 184

Class

SearchSubscriber
Extends Solarium plugin: authenticate, etc.

Namespace

Drupal\acquia_search\EventSubscriber

Code

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);
}