function TestController::getCsrfToken
Same name in other branches
- 8.9.x core/modules/system/tests/modules/csrf_race_test/src/Controller/TestController.php \Drupal\csrf_race_test\Controller\TestController::getCsrfToken()
- 10 core/modules/system/tests/modules/csrf_race_test/src/Controller/TestController.php \Drupal\csrf_race_test\Controller\TestController::getCsrfToken()
- 11.x core/modules/system/tests/modules/csrf_race_test/src/Controller/TestController.php \Drupal\csrf_race_test\Controller\TestController::getCsrfToken()
Just return generated CSRF token for concurrent requests.
We delay the response to the first request to make sure the second request is made when the first is not yet finished.
Return value
\Symfony\Component\HttpFoundation\Response CSRF token.
1 string reference to 'TestController::getCsrfToken'
- csrf_race_test.routing.yml in core/
modules/ system/ tests/ modules/ csrf_race_test/ csrf_race_test.routing.yml - core/modules/system/tests/modules/csrf_race_test/csrf_race_test.routing.yml
File
-
core/
modules/ system/ tests/ modules/ csrf_race_test/ src/ Controller/ TestController.php, line 62
Class
- TestController
- Controller to test concurrent CSRF token generation.
Namespace
Drupal\csrf_race_test\ControllerCode
public function getCsrfToken($num) {
sleep($num);
return new JsonResponse($this->tokenGenerator
->get());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.