function SearchApiAcquiaSearchConnection::authenticator in Acquia Search for Search API 7.2
Creates an authenticator based on a data string and HMAC-SHA1.
See also
1 call to SearchApiAcquiaSearchConnection::authenticator()
- SearchApiAcquiaSearchConnection::authCookie in includes/
v2/ SearchApiAcquiaSearchConnection.php - Modify a solr base url and construct a hmac authenticator cookie.
File
- includes/
v2/ SearchApiAcquiaSearchConnection.php, line 22
Class
- SearchApiAcquiaSearchConnection
- Starting point for the Solr API. Represents a Solr server resource and has methods for pinging, adding, deleting, committing, optimizing and searching.
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 . ';';
}
}