You are here

private function SearchApiAcquiaSearchConnectionV3::extractHmac in Acquia Search for Search API 7.2

Extracts HMAC value from headers.

Parameters

array $headers: Headers list.

Return value

string HMAC string.

1 call to SearchApiAcquiaSearchConnectionV3::extractHmac()
SearchApiAcquiaSearchConnectionV3::authenticateResponse in includes/v3/SearchApiAcquiaSearchConnectionV3.php
Makes authentication checks.

File

includes/v3/SearchApiAcquiaSearchConnectionV3.php, line 254

Class

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

Code

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