private function SearchApiAcquiaSearchConnectionV3::buildAuthString in Acquia Search for Search API 7.2
Builds auth string.
Parameters
string $string: Payload.
string $nonce: Nonce.
Return value
string Auth string.
1 call to SearchApiAcquiaSearchConnectionV3::buildAuthString()
- SearchApiAcquiaSearchConnectionV3::createAuthCookie in includes/
v3/ SearchApiAcquiaSearchConnectionV3.php - Creates auth cookie.
File
- includes/
v3/ SearchApiAcquiaSearchConnectionV3.php, line 194
Class
- SearchApiAcquiaSearchConnectionV3
- Starting point for the Solr API. Represents a Solr server resource and has methods for pinging, adding, deleting, committing, optimizing and searching.
Code
private function buildAuthString($string, $nonce) {
$api = SearchApiAcquiaApi::getFromSettings();
if (empty($api)) {
return '';
}
$preferredCoreService = $api
->getPreferredCoreService();
if (empty($preferredCoreService
->isPreferredCoreAvailable())) {
return '';
}
$index = $preferredCoreService
->getPreferredCore();
$derived_key = $this
->createDerivedKey($index['data']['product_policies']['salt'], $index['data']['key'], $index['data']['secret_key']);
$hmac = hash_hmac('sha1', REQUEST_TIME . $nonce . $string, $derived_key);
return sprintf('acquia_solr_time=%s; acquia_solr_nonce=%s; acquia_solr_hmac=%s;', REQUEST_TIME, $nonce, $hmac);
}