You are here

public function CsrfAccessCheck::access in Flag 8.4

Checks access based on a CSRF token for the request for auth users.

Parameters

\Symfony\Component\Routing\Route $route: The route to check against.

\Symfony\Component\HttpFoundation\Request $request: The request object.

\Drupal\Core\Routing\RouteMatchInterface $route_match: The route match object.

Return value

\Drupal\Core\Access\AccessResultInterface The access result, always allowed for anonymous users.

File

src/Access/CsrfAccessCheck.php, line 53

Class

CsrfAccessCheck
Proxy class to the core CSRF access chcker allowing anonymous requests.

Namespace

Drupal\flag\Access

Code

public function access(Route $route, Request $request, RouteMatchInterface $route_match) {

  // As the original returns AccessResult::allowedif the token validates,
  // we do the same for anonymous.
  return $this->account
    ->isAnonymous() ? AccessResult::allowed() : $this->original
    ->access($route, $request, $route_match);
}