You are here

public function CsrfTokenController::csrfToken in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/system/src/Controller/CsrfTokenController.php \Drupal\system\Controller\CsrfTokenController::csrfToken()
  2. 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.

1 string reference to 'CsrfTokenController::csrfToken'
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',
  ]);
}