You are here

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

Look in the headers and get the hmac_digest out.

Parameters

$headers:

Return value

string hmac_digest

1 call to SearchSubscriber::extractHmac()
SearchSubscriber::authenticateResponse in src/EventSubscriber/SearchSubscriber.php
Validate the hmac for the response body.

File

src/EventSubscriber/SearchSubscriber.php, line 100

Class

SearchSubscriber

Namespace

Drupal\acquia_search_multi_subs\EventSubscriber

Code

public function extractHmac($headers) {
  $reg = array();
  if (is_array($headers)) {
    foreach ($headers as $value) {
      if (stristr($value, 'pragma') && preg_match("/hmac_digest=([^;]+);/i", $value, $reg)) {
        return trim($reg[1]);
      }
    }
  }
  return '';
}