CSRFCallbackAccessCheck.php in Brightcove Video Connect 8.2
Same filename and directory in other branches
Namespace
Drupal\brightcove\AccessFile
src/Access/CSRFCallbackAccessCheck.phpView source
<?php
namespace Drupal\brightcove\Access;
use Drupal\Core\Access\AccessResult;
use Drupal\Core\Routing\Access\AccessInterface;
use Drupal\Core\Routing\RouteMatchInterface;
/**
* Custom CSRF access check callback.
*/
class CSRFCallbackAccessCheck implements AccessInterface {
/**
* Custom access callback.
*
* @param \Drupal\Core\Routing\RouteMatchInterface $route_match
* RouterMatch object.
*
* @return \Drupal\Core\Access\AccessResult
* Access allowed only if the token is exists and did not expired.
*/
public function access(RouteMatchInterface $route_match) {
$token = $route_match
->getParameter('token');
return AccessResult::allowedIf(\Drupal::keyValueExpirable('brightcove_callback')
->has($token));
}
}
Classes
Name | Description |
---|---|
CSRFCallbackAccessCheck | Custom CSRF access check callback. |