8000 [Security] Tweak UsernamePasswordFormAuthenticationListener by acasademont · Pull Request #5824 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Security] Tweak UsernamePasswordFormAuthenticationListener #5824

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 28, 2012
Merged

[Security] Tweak UsernamePasswordFormAuthenticationListener #5824

merged 1 commit into from
Oct 28, 2012

Conversation

acasademont
Copy link
Contributor

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: Build Status
Fixes the following tickets: -
Todo: -
License of the code: MIT
Documentation PR: -

Improvements:

  • Do not check twice for the only_post condition. The condition in the attemptAuthentication method is useless as this method will never be called if the previous requiresAuthentication call returns false.
  • If the expected request is only_post, check only the POST variables for the username and password parameters. Otherwise, query params and attributes are checked before.
  • Use POST instead of post for correctness

- Do not check twice for the only_post condition
- If the expected request is only_post, check only the post variables for the username and password parameters
}

return null;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why removing this ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct me if I am wrong but as said in the description of the PR, the attemptAuthentication method is called only if the requiresAuthentication does not return false. If this premise is correct, the post_only option is true and the request method is not POST, requiresAuthentication will return false and attemptAuthentication will not be called. Therefore, the condition you are asking is useless as it will be false all the time.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the record, this was introduced in #4524

fabpot added a commit that referenced this pull request Oct 28, 2012
This PR was merged into the master branch.

Commits
-------

3e58893 [Security] Tweak UsernamePasswordFormAuthenticationListener

Discussion
----------

[Security] Tweak UsernamePasswordFormAuthenticationListener

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: [![Build Status](https://secure.travis-ci.org/acasademont/symfony.png)](http://travis-ci.org/acasademont/symfony)
Fixes the following tickets: -
Todo: -
License of the code: MIT
Documentation PR: -

Improvements:

- Do not check twice for the ```only_post``` condition. The condition in the ```attemptAuthentication``` method is useless as this method will never be called if the previous ```requiresAuthentication``` call returns false.
- If the expected request is ```only_post```, check only the POST variables for the username and password parameters. Otherwise, query params and attributes are checked before.
- Use POST instead of post for correctness
@fabpot fabpot merged commit 3e58893 into symfony:master Oct 28, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0