You are here

protected function SearchSubscriber::authenticateResponse in Acquia Search 3.x

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

Validate the hmac for the response body.

Parameters

\Solarium\Core\Client\Response $response: Solarium Response.

string $nonce: Nonce.

string $url: Url.

Return value

\Solarium\Core\Client\Response Solarium Response.

Throws

\Solarium\Exception\HttpException

1 call to SearchSubscriber::authenticateResponse()
SearchSubscriber::postExecuteRequest in src/EventSubscriber/SearchSubscriber.php
Validate response.

File

src/EventSubscriber/SearchSubscriber.php, line 173

Class

SearchSubscriber
Class SearchSubscriber.

Namespace

Drupal\acquia_search\EventSubscriber

Code

protected function authenticateResponse(Response $response, $nonce, $url) {
  $hmac = $this
    ->extractHmac($response
    ->getHeaders());
  if (!$this
    ->validateResponse($hmac, $nonce, $response
    ->getBody())) {
    throw new HttpException('Authentication of search content failed url: ' . $url);
  }
  return $response;
}