This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Bundle/SecurityBundle
Fabien Potencier 1fc7b86f07 feature #36243 [Security] Refactor logout listener to dispatch an event instead (wouterj)
This PR was squashed before being merged into the 5.1-dev branch.

Discussion
----------

[Security] Refactor logout listener to dispatch an event instead

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes (sort of...)
| New feature?  | yes
| Deprecations? | yes
| Tickets       | Fix #25212, Fix #22473
| License       | MIT
| Doc PR        | tbd

The current `LogoutListener` has some extension points, but they are not really DX-friendly (ref #25212). It requires hacking a `addMethodCall('addHandler')` in the container builder to register a custom logout handler.
Also, it is impossible to overwrite the default logout functionality from a bundle (ref #22473).

This PR introduces a `LogoutEvent` that replaces both the `LogoutSuccessHandlerInterface` and `LogoutHandlerInterface`. This provides a DX-friendly extension point and also cleans up the authentication factories (no more `addMethodCall()`'s).

In order to allow different logout handlers for different firewalls, I created a specific event dispatcher for each firewall (as also shortly discussed in #33558). The `dispatcher` tag attribute allows you to specify which dispatcher it should be registered to (defaulting to the global dispatcher). The `EventBubblingLogoutListener` also dispatches logout events on the global dispatcher, to be used for listeners that should run on all firewalls.

_@weaverryan and I discussed this feature while working on #33558, but figured it was unrelated and could be done while preservering BC. So that's why a separate PR is created._

Commits
-------

a9f096eb1f [Security] Refactor logout listener to dispatch an event instead
2020-04-04 13:02:32 +02:00
..
CacheWarmer add parameter type declarations where possible 2019-07-29 16:41:19 +02:00
Command Merge branch '3.4' into 4.4 2020-02-07 09:47:19 +01:00
DataCollector Fix quotes in exception messages 2020-03-16 09:31:04 +01:00
Debug Fix CS 2020-02-04 10:47:34 +01:00
DependencyInjection feature #36243 [Security] Refactor logout listener to dispatch an event instead (wouterj) 2020-04-04 13:02:32 +02:00
EventListener [Security] Refactor logout listener to dispatch an event instead 2020-04-04 13:02:21 +02:00
Resources [Security] Refactor logout listener to dispatch an event instead 2020-04-04 13:02:21 +02:00
Security [Security] Refactor logout listener to dispatch an event instead 2020-04-04 13:02:21 +02:00
Tests [DependencyInjection] Deprecate ContainerInterface aliases 2020-04-01 09:27:41 +02:00
.gitattributes add missing gitattributes for phpunit-bridge 2020-03-27 17:54:36 +01:00
.gitignore Added missing files .gitignore 2013-07-21 14:12:18 +02:00
CHANGELOG.md [SecurityBundle] Added XSD for the extension configuration 2020-03-15 11:26:52 +01:00
composer.json [Security] Refactor logout listener to dispatch an event instead 2020-04-04 13:02:21 +02:00
LICENSE Update year in license files 2020-01-01 12:03:25 +01:00
phpunit.xml.dist Bump phpunit XSD version to 5.2 2018-11-11 12:18:13 +01:00
README.md add readme files where missing 2016-03-07 11:36:15 +01:00
SecurityBundle.php Merge branch '4.4' 2019-10-07 11:06:09 +02:00