You are here

function SearchApiAcquiaSearchHttpTransport::authenticator in Acquia Search for Search API 7

Creates an authenticator based on a data string and HMAC-SHA1.

See also

acquia_search_authenticator()

1 call to SearchApiAcquiaSearchHttpTransport::authenticator()
SearchApiAcquiaSearchHttpTransport::authCookie in includes/SearchApiAcquiaSearchHttpTransport.php
Modify a solr base url and construct a hmac authenticator cookie.

File

includes/SearchApiAcquiaSearchHttpTransport.php, line 25
Contains SearchApiAcquiaSearchHttpTransport.

Class

SearchApiAcquiaSearchHttpTransport
HTTP transport for connections to the Acquia Search Service.

Code

function authenticator($string, $nonce, $derived_key = NULL) {
  if (empty($derived_key)) {
    $derived_key = $this
      ->getDerivedKey();
  }
  if (empty($derived_key)) {

    // Expired or invalid subscription - don't continue.
    return '';
  }
  else {
    $time = time();
    $hash = hash_hmac('sha1', $time . $nonce . $string, $derived_key);
    return 'acquia_solr_time=' . $time . '; acquia_solr_nonce=' . $nonce . '; acquia_solr_hmac=' . $hash . ';';
  }
}