You are here

public function CsrfTokenController::csrfToken in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/system/src/Controller/CsrfTokenController.php \Drupal\system\Controller\CsrfTokenController::csrfToken()

Returns a CSRF protecting session token.

Return value

\Symfony\Component\HttpFoundation\Response The response object.

2 string references to 'CsrfTokenController::csrfToken'
rest.routing.yml in core/modules/rest/rest.routing.yml
core/modules/rest/rest.routing.yml
system.routing.yml in core/modules/system/system.routing.yml
core/modules/system/system.routing.yml

File

core/modules/system/src/Controller/CsrfTokenController.php, line 48

Class

CsrfTokenController
Returns responses for CSRF token routes.

Namespace

Drupal\system\Controller

Code

public function csrfToken() {
  return new Response($this->tokenGenerator
    ->get(CsrfRequestHeaderAccessCheck::TOKEN_KEY), 200, [
    'Content-Type' => 'text/plain',
  ]);
}