You are here

function acquia_search_authenticator in Acquia Connector 7

Same name and namespace in other branches
  1. 7.3 acquia_search/acquia_search.module \acquia_search_authenticator()
  2. 7.2 acquia_search/acquia_search.module \acquia_search_authenticator()

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

1 call to acquia_search_authenticator()
acquia_search_auth_cookie in acquia_search/acquia_search.module
Modify a solr base url and construct a hmac authenticator cookie.

File

acquia_search/acquia_search.module, line 297
Integration between Acquia Drupal and Acquia's hosted solr search service.

Code

function acquia_search_authenticator($string, $nonce, $derived_key = NULL, $env_id = NULL) {
  if (empty($derived_key)) {
    $derived_key = _acquia_search_derived_key($env_id);
  }
  if (empty($derived_key)) {

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