Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[FrameworkBundle][HttpKernel] Add session usage reporting in stateless mode#35732
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
mtarld commentedFeb 15, 2020
One thing I'm wondering, should we need the |
nicolas-grekas commentedFeb 15, 2020
The request attribute is a nice idea. |
mtarld commentedFeb 15, 2020
Yes it could be great, I'll give it a try |
mtarld commentedFeb 16, 2020
I had tried this approach but something came up to me. |
mtarld commentedFeb 18, 2020
@nicolas-grekas I updated code according to your approach. But what should we do when session is used in a stateless mode ? Should we throw an exception ? Just log it ? Or even make that behavior configurable ? |
nicolas-grekas commentedFeb 18, 2020
Throw when no logger is passed, log when one is - and pass one when kernel.debug=false in the DI extension? |
mtarld commentedFeb 18, 2020
Ok, so now if debug is enabled, this will throw an exception. If not, it'll log a warning. |
nicolas-grekas left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
LGTM, don't miss adding some tests and a CHANGELOG entry.
Uh oh!
There was an error while loading.Please reload this page.
f5d6f6c tob8e83bbComparesrc/Symfony/Component/HttpKernel/EventListener/AbstractSessionListener.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
@Stateless annotationUh oh!
There was an error while loading.Please reload this page.
9a9e4dd to85a6a10Comparesrc/Symfony/Component/HttpKernel/EventListener/AbstractSessionListener.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
33ed3e8 tobc48db2Comparefabpot commentedFeb 26, 2020
Thank you@mtarld. |
This PR was merged into the 5.1-dev branch.Discussion----------[Routing] Add stateless route attribute| Q | A| ------------- | ---| Branch? | master| Bug fix? | no| New feature? | yes| Deprecations? | no| Ticket|https://github.com/orgs/symfony/projects/1#card-30506005| License | MIT| Doc PR | TODOOn top of#35732Add a stateless attribute for:Routes in annotations```@route(stateless=true)```Yaml```ymlroute: stateless: true```Xml```xml<route stateless="true" />```PHP configurator```php$route->stateless(true);```That stateless attribute is a shortcut for setting `_stateless` default attribute in route.Commits-------2da68ba [Routing] Add stateless route attribute
Uh oh!
There was an error while loading.Please reload this page.
https://github.com/orgs/symfony/projects/1#card-30506005
Provide a
statelessattribute that forbid session usage.Implementations
v1
New session proxy that allows session to be marked as disabledNew default route attribute:_stateless(automatically set by@Stateless)On kernel controller event, if_statelessistrue, session is marked as disabledSession listener is able to check if the session is disabled and prevent its creationv2
New default route attribute:_stateless(automatically set by@Stateless)On kernel response, check the session usage and if session was used when_statelessattribute is set totrue: Either throw an exception (debug enabled) or log a warning (debug disabled)v3
_stateless(automatically set bystatelessroute attribute)_statelessattribute is set totrue: Either throw an exception (debug enabled) or log a warning (debug disabled)