You are here

private function AcquiaSearchSolrService::buildAuthString in Acquia Connector 7.3

Builds auth string.

Parameters

string $string: Payload.

string $nonce: Nonce.

Return value

string Auth string.

1 call to AcquiaSearchSolrService::buildAuthString()
AcquiaSearchSolrService::createAuthCookie in acquia_search/includes/AcquiaSearchSolrService.php
Creates auth cookie.

File

acquia_search/includes/AcquiaSearchSolrService.php, line 189

Class

AcquiaSearchSolrService
Class AcquiaSearchSolrService.

Code

private function buildAuthString($string, $nonce) {
  $api = _acquia_search_solr_get_api();
  if (empty($api)) {
    return '';
  }
  $preferredIndexService = $api
    ->getPreferredIndexService();
  if (empty($preferredIndexService
    ->isPreferredIndexAvailable())) {
    return '';
  }
  $index = $preferredIndexService
    ->getPreferredIndex();
  $derived_key = $this
    ->createDerivedKey($index['data']['product_policies']['salt'], $index['data']['key'], $index['data']['secret_key']);
  $hmac = hash_hmac('sha1', REQUEST_TIME . $nonce . $string, $derived_key);
  return sprintf('acquia_solr_time=%s; acquia_solr_nonce=%s; acquia_solr_hmac=%s;', REQUEST_TIME, $nonce, $hmac);
}