From deacd0dfc195bca41af631114804d29937337cd8 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Wed, 17 Jan 2024 02:11:31 +0900 Subject: . --- services/app/src/Twig/CsrfExtension.php | 45 +++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 services/app/src/Twig/CsrfExtension.php (limited to 'services/app/src/Twig') diff --git a/services/app/src/Twig/CsrfExtension.php b/services/app/src/Twig/CsrfExtension.php new file mode 100644 index 0000000..b6369a2 --- /dev/null +++ b/services/app/src/Twig/CsrfExtension.php @@ -0,0 +1,45 @@ +csrf->getTokenNameKey(); + $csrf_name = $this->csrf->getTokenName(); + assert( + isset($csrf_name), + 'It must be present here because the access is denied by Csrf\Guard middleware if absent.', + ); + + $csrf_value_key = $this->csrf->getTokenValueKey(); + $csrf_value = $this->csrf->getTokenValue(); + assert( + isset($csrf_value), + 'It must be present here because the access is denied by Csrf\Guard middleware if absent.', + ); + + return [ + 'csrf' => [ + 'name_key' => $csrf_name_key, + 'name' => $csrf_name, + 'value_key' => $csrf_value_key, + 'value' => $csrf_value + ] + ]; + } +} -- cgit v1.2.3-70-g09d2