You are here

protected function Client::validateResponse in Acquia Connector 3.x

Same name and namespace in other branches
  1. 8.2 src/Client.php \Drupal\acquia_connector\Client::validateResponse()
  2. 8 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'];
}