Skip to content

Commit 6784ec4

Browse files
authored
ListenerInterface deprecated since Symfony 4.3
Symfony\Component\Security\Http\Firewall deprecation comment: @deprecated since Symfony 4.3, turn listeners into callables instead Targeting 4.3 branch as per @OskarStark comment in original PR #12780 (comment)
1 parent 2ad6aaa commit 6784ec4

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

security/custom_authentication_provider.rst

+3-5
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@ The Listener
9797

9898
Next, you need a listener to listen on the firewall. The listener
9999
is responsible for fielding requests to the firewall and calling the authentication
100-
provider. A listener must be an instance of
101-
:class:`Symfony\\Component\\Security\\Http\\Firewall\\ListenerInterface`.
100+
provider. Listener is a callable, so you have to implement __invoke() method.
102101
A security listener should handle the
103102
:class:`Symfony\\Component\\HttpKernel\\Event\\RequestEvent` event, and
104103
set an authenticated token in the token storage if successful::
@@ -112,9 +111,8 @@ set an authenticated token in the token storage if successful::
112111
use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface;
113112
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
114113
use Symfony\Component\Security\Core\Exception\AuthenticationException;
115-
use Symfony\Component\Security\Http\Firewall\ListenerInterface;
116114

117-
class WsseListener implements ListenerInterface
115+
class WsseListener
118116
{
119117
protected $tokenStorage;
120118
protected $authenticationManager;
@@ -125,7 +123,7 @@ set an authenticated token in the token storage if successful::
125123
$this->authenticationManager = $authenticationManager;
126124
}
127125

128-
public function handle(RequestEvent $event)
126+
public function __invoke(RequestEvent $event)
129127
{
130128
$request = $event->getRequest();
131129

0 commit comments

Comments
 (0)