Skip to content

Commit ae2ec36

Browse files
committed
merged branch henrikbjorn/require-authentication (PR #4525)
Commits ------- 6a01d3d [Security] Check post_only option and request method Discussion ---------- [Security] Take `post_only` into consideration in requiresAuthentication Change requiresAuthentication to look at the `post_only` option. Fixes #4524 --------------------------------------------------------------------------- by travisbot at 2012-06-08T18:26:21Z This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1570033) (merged 6d799494 into b84b46b). --------------------------------------------------------------------------- by travisbot at 2012-06-09T11:34:59Z This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1575681) (merged af676bb5 into b84b46b). --------------------------------------------------------------------------- by stof at 2012-06-09T14:01:21Z @henrikbjorn could you squash the commit, or cherry-pick the third one so that it is the only one ? The reverted commit seems weird in the PR. --------------------------------------------------------------------------- by henrikbjorn at 2012-06-09T14:18:08Z @stof there. Actually it cannot be squashed. But maybe what i did was wrong. ``` shell git reset --hard b84b46b git cherry-pick af676bb5d01f835b2f9913e129e6c6eb3320dd26 git push -f henrikbjorn require-authentication ``` --------------------------------------------------------------------------- by travisbot at 2012-06-09T14:22:59Z This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1576658) (merged 6a01d3d into 3bb7dc0). --------------------------------------------------------------------------- by stof at 2012-06-09T14:39:25Z @fabpot 👍
2 parents dedaa82 + 6a01d3d commit ae2ec36

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)