function CsrfTokenController::csrfToken
Same name in other branches
- 9 core/modules/system/src/Controller/CsrfTokenController.php \Drupal\system\Controller\CsrfTokenController::csrfToken()
- 8.9.x core/modules/system/src/Controller/CsrfTokenController.php \Drupal\system\Controller\CsrfTokenController::csrfToken()
- 11.x 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\ControllerCode
public function csrfToken() {
return new Response($this->tokenGenerator
->get(CsrfRequestHeaderAccessCheck::TOKEN_KEY), 200, [
'Content-Type' => 'text/plain',
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.