Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions security/custom_authentication_provider.rst
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ The Listener

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

class WsseListener implements ListenerInterface
class WsseListener
{
protected $tokenStorage;
protected $authenticationManager;
Expand All @@ -125,7 +123,7 @@ set an authenticated token in the token storage if successful::
$this->authenticationManager = $authenticationManager;
}

public function handle(RequestEvent $event)
public function __invoke(RequestEvent $event)
{
$request = $event->getRequest();

Expand Down