You are here

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

Same name and namespace in other branches
  1. 3.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 138

Class

SearchSubscriber
Extends Solarium plugin: authenticate, etc.

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;
}