Skip to content

Commit bca776a

Browse files
committed
minor #18353 [Security] Use POST method for logout route (alexandre-daubois)
This PR was merged into the 5.4 branch. Discussion ---------- [Security] Use POST method for logout route Resolves #17412 Commits ------- 20a7e79 [Security] Use POST method for logout route
2 parents c43c54d + 20a7e79 commit bca776a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

security.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -1686,7 +1686,7 @@ Next, you need to create a route for this URL (but not a controller):
16861686
class SecurityController extends AbstractController
16871687
{
16881688
/**
1689-
* @Route("/logout", name="app_logout", methods={"GET"})
1689+
* @Route("/logout", name="app_logout", methods={"POST"})
16901690
*/
16911691
public function logout(): void
16921692
{
@@ -1705,7 +1705,7 @@ Next, you need to create a route for this URL (but not a controller):
17051705
17061706
class SecurityController extends AbstractController
17071707
{
1708-
#[Route('/logout', name: 'app_logout', methods: ['GET'])]
1708+
#[Route('/logout', name: 'app_logout', methods: ['POST'])]
17091709
public function logout()
17101710
{
17111711
// controller can be blank: it will never be called!
@@ -1718,7 +1718,7 @@ Next, you need to create a route for this URL (but not a controller):
17181718
# config/routes.yaml
17191719
app_logout:
17201720
path: /logout
1721-
methods: GET
1721+
methods: POST
17221722
17231723
.. code-block:: xml
17241724
@@ -1729,7 +1729,7 @@ Next, you need to create a route for this URL (but not a controller):
17291729
xsi:schemaLocation="http://symfony.com/schema/routing
17301730
https://symfony.com/schema/routing/routing-1.0.xsd">
17311731
1732-
<route id="app_logout" path="/logout" methods="GET"/>
1732+
<route id="app_logout" path="/logout" methods="POST"/>
17331733
</routes>
17341734
17351735
.. code-block:: php
@@ -1739,7 +1739,7 @@ Next, you need to create a route for this URL (but not a controller):
17391739
17401740
return function (RoutingConfigurator $routes) {
17411741
$routes->add('app_logout', '/logout')
1742-
->methods(['GET'])
1742+
->methods(['POST'])
17431743
;
17441744
};
17451745

0 commit comments

Comments
 (0)