You are here

public function RequestHandler::csrfToken in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/rest/src/RequestHandler.php \Drupal\rest\RequestHandler::csrfToken()

Generates a CSRF protecting session token.

Return value

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

1 string reference to 'RequestHandler::csrfToken'
rest.routing.yml in core/modules/rest/rest.routing.yml
core/modules/rest/rest.routing.yml

File

core/modules/rest/src/RequestHandler.php, line 136
Contains \Drupal\rest\RequestHandler.

Class

RequestHandler
Acts as intermediate request forwarder for resource plugins.

Namespace

Drupal\rest

Code

public function csrfToken() {
  return new Response(\Drupal::csrfToken()
    ->get('rest'), 200, array(
    'Content-Type' => 'text/plain',
  ));
}