public function SearchSubscriber::calculateAuthCookie in Acquia Search Multiple Indexes 8
Creates an authenticator based on a data string and HMAC-SHA1.
Parameters
$string:
$nonce:
null $derived_key:
null $env_id:
Return value
string
1 call to SearchSubscriber::calculateAuthCookie()
- SearchSubscriber::preExecuteRequest in src/
EventSubscriber/ SearchSubscriber.php - Build Acquia Solr Search Authenticator.
File
- src/
EventSubscriber/ SearchSubscriber.php, line 211
Class
Namespace
Drupal\acquia_search_multi_subs\EventSubscriberCode
public function calculateAuthCookie($string, $nonce, $derived_key = NULL, $env_id = NULL) {
if (empty($derived_key)) {
$derived_key = $this
->getDerivedKey($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) . ';';
}
}