diff options
author | Fabien Potencier <fabien.potencier@gmail.com> | 2011-09-22 18:43:18 +0200 |
---|---|---|
committer | Fabien Potencier <fabien.potencier@gmail.com> | 2011-09-25 09:46:00 +0200 |
commit | e8fe7ed32c2e639935dca15b6cc2d91138dec7e2 (patch) | |
tree | 8eef7366e723d9869012895876609e470511ddac /Core/Encoder | |
parent | eff1360d2f1f16982544997ac5f6d6670a7bb736 (diff) | |
download | symfony-security-e8fe7ed32c2e639935dca15b6cc2d91138dec7e2.zip symfony-security-e8fe7ed32c2e639935dca15b6cc2d91138dec7e2.tar.gz symfony-security-e8fe7ed32c2e639935dca15b6cc2d91138dec7e2.tar.bz2 |
merged branch helmer/target_path (PR #2228)
Commits
-------
022a9a7 [Security] Make saving target_path extendible
Discussion
----------
[Security] Make saving target_path extendible
The problem lies in how Security component handles ``target_path`` - the latest request URI is always stored. This can lead to problems in following scenarios:
a) The response type of the request is not HTML (think JSON, XML ..)
b) The URI matches a route that does not listen to HTTP GET
I opened a [PR](https://github.com/symfony/symfony/pull/604) months ago, to partly solve scenario A, which did not make it. Now I am proposing a different solution - user can extend ``ExceptionListener`` and override the logic behind setting the ``target_path`` to match his precise needs.
In my simplified scenario, I would be using:
```
protected function setTargetPath(Request $request)
{
if ($request->isXmlHttpRequest() || 'GET' !== $request->getMethod()) {
return;
}
$request->getSession()->set('_security.target_path', $request->getUri());
}
```
@Seldaek, @schmittjoh, @lsmith77, thoughts?
---------------------------------------------------------------------------
by Seldaek at 2011/09/21 02:37:02 -0700
Seems like a better solution for flexibility's sake. Would be quite awesome if you could add a cookbook entry to symfony/symfony-docs about this, otherwise I'm afraid we'll have to explain it over and over again :)
---------------------------------------------------------------------------
by helmer at 2011/09/21 03:38:57 -0700
[Cookbook](https://github.com/helmer/symfony-docs/commit/b22c5e666edb2586840884e32f8209425125c30d) entry done. Perhaps though I rushed ahead ..
---------------------------------------------------------------------------
by Seldaek at 2011/09/21 03:52:01 -0700
Thanks. You can already do a pull request against symfony-docs, just reference this pull request in it so it's not merged before this is merged.
Diffstat (limited to 'Core/Encoder')
0 files changed, 0 insertions, 0 deletions