Skip to content

Commit 6a01d3d

Browse files
committed
[Security] Check post_only option and request method
1 parent b84b46b commit 6a01d3d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/Symfony/Component/Security/Http/Firewall/UsernamePasswordFormAuthenticationListener.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,18 @@ public function __construct(SecurityContextInterface $securityContext, Authentic
5050
$this->csrfProvider = $csrfProvider;
5151
}
5252

53+
/**
54+
* @{inheritdoc}
55+
*/
56+
protected function requiresAuthentication(Request $request)
57+
{
58+
if ($this->options['post_only'] && !$request->isMethod('post')) {
59+
return false;
60+
}
61+
62+
return parent::requiresAuthentication($request);
63+
}
64+
5365
/**
5466
* {@inheritdoc}
5567
*/

0 commit comments

Comments
 (0)