mirror of
https://github.com/wallabag/wallabag.git
synced 2025-08-01 17:38:38 +00:00
Replace AuthenticationEvents::AUTHENTICATION_FAILURE by LoginFailureEvent
This commit is contained in:
parent
c50265c1eb
commit
1127b147c0
2 changed files with 7 additions and 14 deletions
|
@ -5,7 +5,7 @@ namespace Wallabag\Event\Listener;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
use Symfony\Component\HttpFoundation\RequestStack;
|
use Symfony\Component\HttpFoundation\RequestStack;
|
||||||
use Symfony\Component\Security\Core\AuthenticationEvents;
|
use Symfony\Component\Security\Http\Event\LoginFailureEvent;
|
||||||
|
|
||||||
class AuthenticationFailureListener implements EventSubscriberInterface
|
class AuthenticationFailureListener implements EventSubscriberInterface
|
||||||
{
|
{
|
||||||
|
@ -21,7 +21,7 @@ class AuthenticationFailureListener implements EventSubscriberInterface
|
||||||
public static function getSubscribedEvents(): array
|
public static function getSubscribedEvents(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
AuthenticationEvents::AUTHENTICATION_FAILURE => 'onAuthenticationFailure',
|
LoginFailureEvent::class => 'onAuthenticationFailure',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,10 +8,9 @@ use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\RequestStack;
|
use Symfony\Component\HttpFoundation\RequestStack;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
|
||||||
use Symfony\Component\Security\Core\AuthenticationEvents;
|
|
||||||
use Symfony\Component\Security\Core\Event\AuthenticationFailureEvent;
|
|
||||||
use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
||||||
|
use Symfony\Component\Security\Http\Authenticator\AuthenticatorInterface;
|
||||||
|
use Symfony\Component\Security\Http\Event\LoginFailureEvent;
|
||||||
use Wallabag\Event\Listener\AuthenticationFailureListener;
|
use Wallabag\Event\Listener\AuthenticationFailureListener;
|
||||||
|
|
||||||
class AuthenticationFailureListenerTest extends TestCase
|
class AuthenticationFailureListenerTest extends TestCase
|
||||||
|
@ -43,7 +42,7 @@ class AuthenticationFailureListenerTest extends TestCase
|
||||||
|
|
||||||
public function testOnAuthenticationFailure()
|
public function testOnAuthenticationFailure()
|
||||||
{
|
{
|
||||||
$token = $this->getMockBuilder(TokenInterface::class)
|
$authenticator = $this->getMockBuilder(AuthenticatorInterface::class)
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
|
@ -51,15 +50,9 @@ class AuthenticationFailureListenerTest extends TestCase
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
$event = new AuthenticationFailureEvent(
|
$event = new LoginFailureEvent($exception, $authenticator, $this->requestStack->getMainRequest(), null, 'main', null);
|
||||||
$token,
|
|
||||||
$exception
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->dispatcher->dispatch(
|
$this->dispatcher->dispatch($event);
|
||||||
$event,
|
|
||||||
AuthenticationEvents::AUTHENTICATION_FAILURE
|
|
||||||
);
|
|
||||||
|
|
||||||
$records = $this->logHandler->getRecords();
|
$records = $this->logHandler->getRecords();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue