You are here

public function SearchSubscriber::validateResponse in Acquia Search Multiple Indexes 8

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

Parameters

$hmac:

$nonce:

$string:

null $derived_key:

null $env_id:

Return value

bool

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 123

Class

SearchSubscriber

Namespace

Drupal\acquia_search_multi_subs\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);
}