You are here

public function SearchSubscriber::getDerivedKey in Acquia Search 3.x

Same name and namespace in other branches
  1. 2.x src/EventSubscriber/SearchSubscriber.php \Drupal\acquia_search\EventSubscriber\SearchSubscriber::getDerivedKey()

Get the derived key.

Get the derived key for the solr hmac using the information shared with acquia.com.

Parameters

string $env_id: Environment Id.

Return value

string|null Derived Key.

2 calls to SearchSubscriber::getDerivedKey()
SearchSubscriber::calculateAuthCookie in src/EventSubscriber/SearchSubscriber.php
Creates an authenticator based on a data string and HMAC-SHA1.
SearchSubscriber::validateResponse in src/EventSubscriber/SearchSubscriber.php
Validate the authenticity of returned data using a nonce and HMAC-SHA1.

File

src/EventSubscriber/SearchSubscriber.php, line 248

Class

SearchSubscriber
Class SearchSubscriber.

Namespace

Drupal\acquia_search\EventSubscriber

Code

public function getDerivedKey($env_id = NULL) : ?string {
  if (empty($env_id)) {
    $env_id = $this->client
      ->getEndpoint()
      ->getKey();
  }

  // Get derived key for Acquia Search V3.
  $search_v3_index = $this
    ->getSearchIndexKeys();
  if ($search_v3_index) {
    $this->derivedKey[$env_id] = AcquiaCryptConnector::createDerivedKey($search_v3_index['product_policies']['salt'], $search_v3_index['key'], $search_v3_index['secret_key']);
    return $this->derivedKey[$env_id];
  }
  return NULL;
}