You are here

public function SpiController::sendAccess in Acquia Connector 8

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

Access callback check for SPI send independent call.

1 string reference to 'SpiController::sendAccess'
acquia_connector.routing.yml in ./acquia_connector.routing.yml
acquia_connector.routing.yml

File

src/Controller/SpiController.php, line 1250

Class

SpiController
SPI Controller class.

Namespace

Drupal\acquia_connector\Controller

Code

public function sendAccess() {
  $request = \Drupal::request();
  $storage = new Storage();
  $acquia_key = $storage
    ->getKey();
  if (!empty($acquia_key) && $request
    ->get('key')) {
    $key = sha1(\Drupal::service('private_key')
      ->get());
    if ($key === $request
      ->get('key')) {
      return AccessResultAllowed::allowed();
    }
  }
  return AccessResultForbidden::forbidden();
}