Skip to content

Commit 6fc7aeb

Browse files
committed
Use logout_path() helper + add CSRF protection to logout
1 parent e05392d commit 6fc7aeb

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

config/packages/security.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ security:
5050
# The name of the route to redirect to after logging out
5151
target: homepage
5252

53+
# Secure the logout against CSRF
54+
csrf_parameter: logout
55+
csrf_token_generator: security.csrf.token_manager
56+
5357
# needed because in tests we redefine the 'main' firewall to use
5458
# HTTP Basic instead of the login form, so this firewall has
5559
# multiple authenticators

templates/base.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
</li>
8484
<li class="divider"></li>
8585
<li>
86-
<a href="{{ path('security_logout') }}">
86+
<a href="{{ logout_path() }}">
8787
<i class="fa fa-sign-out" aria-hidden="true"></i> {{ 'menu.logout'|trans }}
8888
</a>
8989
</li>

0 commit comments

Comments
 (0)