public function SearchSubscriber::calculateAuthCookie in Acquia Connector 8
Creates an authenticator based on a data string and HMAC-SHA1.
Parameters
string $string: Data string.
string $nonce: Nonce.
int $time: Request time.
string $derived_key: Derived key.
string $env_id: Environment Id.
Return value
string Auth cookie string.
1 call to SearchSubscriber::calculateAuthCookie()
- SearchSubscriber::preExecuteRequest in acquia_search/
src/ EventSubscriber/ SearchSubscriber.php - Build Acquia Search Solr Authenticator.
File
- acquia_search/
src/ EventSubscriber/ SearchSubscriber.php, line 304
Class
- SearchSubscriber
- Extends Solarium plugin: authenticate, etc.
Namespace
Drupal\acquia_search\EventSubscriberCode
public function calculateAuthCookie($string, $nonce, $time, $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 {
return 'acquia_solr_time=' . $time . '; acquia_solr_nonce=' . $nonce . '; acquia_solr_hmac=' . hash_hmac('sha1', $time . $nonce . $string, $derived_key) . ';';
}
}