aboutsummaryrefslogtreecommitdiffhomepage
path: root/application
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-06-21 12:21:31 +0200
committerArthurHoaro <arthur@hoa.ro>2020-07-23 21:19:21 +0200
commit764d34a7d347d653414e5f5c632e02499edaef04 (patch)
tree1e642a893beefd95bfa82c7beeb416449238b4ec /application
parent1b8620b1ad4e2c647ff2d032c8e7c6687b6647a1 (diff)
downloadShaarli-764d34a7d347d653414e5f5c632e02499edaef04.tar.gz
Shaarli-764d34a7d347d653414e5f5c632e02499edaef04.tar.zst
Shaarli-764d34a7d347d653414e5f5c632e02499edaef04.zip
Process token retrieve through Slim controller
Diffstat (limited to 'application')
-rw-r--r--application/front/controller/admin/TokenController.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/application/front/controller/admin/TokenController.php b/application/front/controller/admin/TokenController.php
new file mode 100644
index 00000000..08d68d0a
--- /dev/null
+++ b/application/front/controller/admin/TokenController.php
@@ -0,0 +1,26 @@
1<?php
2
3declare(strict_types=1);
4
5namespace Shaarli\Front\Controller\Admin;
6
7use Slim\Http\Request;
8use Slim\Http\Response;
9
10/**
11 * Class TokenController
12 *
13 * Endpoint used to retrieve a XSRF token. Useful for AJAX requests.
14 */
15class TokenController extends ShaarliAdminController
16{
17 /**
18 * GET /admin/token
19 */
20 public function getToken(Request $request, Response $response): Response
21 {
22 $response = $response->withHeader('Content-Type', 'text/plain');
23
24 return $response->write($this->container->sessionManager->generateToken());
25 }
26}