-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[Routing][Security] Document the LogoutRouteLoader
#19000
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
Conversation
LogoutRouteLoader
LogoutRouteLoader
…TheCat) This PR was merged into the 6.4 branch. Discussion ---------- [Routing][SecurityBundle] Add `LogoutRouteLoader` | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | Fix #50920 | License | MIT | Doc PR | symfony/symfony-docs#19000 #50920 is about avoiding for users to create logout routes. Given [we don’t want to allow bundles registering routes](#37786), I added a `LogoutRouteLoader` service bearing the `routing.route_loader` tag to be imported by the user. Such import could be added to the SecurityBundle recipe: ```yaml # config/routes/security.yaml logout: resource: security.route_loader.logout type: service ``` To invalidate routes when logout paths change, I stored them in a parameter so that the `ContainerParametersResourceChecker` can check the collection. Not sure if it’s okay or if a better way exists. Commits ------- 0a558d0 [SecurityBundle][Routing] Add `LogoutRouteLoader`
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.
Thanks @MatTheCat for this PR and improving DX !
I had so many time forget to create logout route, or an empty controller felt weird in source code
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.
Thanks for providing all the necessary PRs around your feature!
I've made some suggestions to move away all unnecessary details and showcase how simple this is now :)
Symfony will then un-authenticate users navigating to the configured ``path``, | ||
and redirect them to the configured ``target``. |
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.
Symfony will then un-authenticate users navigating to the configured ``path``, | |
and redirect them to the configured ``target``. | |
Symfony will then un-authenticate users navigating to the configured ``path``, | |
and redirect them to the configured ``target``. You can generate URLs to this | |
path using the ``_security_<firewallname>`` route name (e.g. ``_security_main``). |
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.
Shouldn’t the LogoutUrlGenerator
be mentioned instead?
6584810
to
715899b
Compare
209f22b
to
8906132
Compare
Thank you @MatTheCat for also providing the docs of this cool feature! |
Related to
LogoutRouteLoader
symfony#50946