You are here

protected function Client::validateResponse in Acquia Connector 8

Same name and namespace in other branches
  1. 8.2 src/Client.php \Drupal\acquia_connector\Client::validateResponse()
  2. 3.x src/Client.php \Drupal\acquia_connector\Client::validateResponse()

Validate the response authenticator.

Parameters

string $key: Acquia Subscription key.

array $response: Response.

array $requestAuthenticator: Authenticator array.

Return value

bool TRUE if valid response, FALSE otherwise.

2 calls to Client::validateResponse()
Client::getSubscription in src/Client.php
Get Acquia subscription from Acquia.
Client::sendNspi in src/Client.php
Get Acquia subscription from Acquia.

File

src/Client.php, line 291

Class

Client
Acquia connector client.

Namespace

Drupal\acquia_connector

Code

protected function validateResponse($key, array $response, array $requestAuthenticator) {
  $responseAuthenticator = $response['authenticator'];
  if (!($requestAuthenticator['nonce'] === $responseAuthenticator['nonce'] && $requestAuthenticator['time'] < $responseAuthenticator['time'])) {
    return FALSE;
  }
  $hash = $this
    ->hash($key, $responseAuthenticator['time'], $responseAuthenticator['nonce']);
  return $hash === $responseAuthenticator['hash'];
}