You are here

public function SearchSubscriber::extractHmac in Acquia Connector 8

Look in the headers and get the hmac_digest out.

Parameters

mixed $headers: Headers array.

Return value

string Hmac_digest or empty string.

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

File

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

Class

SearchSubscriber
Extends Solarium plugin: authenticate, etc.

Namespace

Drupal\acquia_search\EventSubscriber

Code

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