Cytat(AxZx @ 14.02.2012, 16:44:43 )

ja też to sprawdzałem i security.authentication.failure było w eventach, no bo w serwisie go dodaliśmy, prawda?

ale nie był ten event obłsługiwany, tzn jeżeli w metodzie podłączonej wpisałem jakiś wyjątek czy coś to niestety nic z tej metody się nie wykonywało.
Dopiero teraz się za to wziąłem i niestety mam tak samo. Zdefiniowałem w swoim services.yml:
kernel.listener.LoginHistoryListener:
class: BDK\UserBundle\Listener\LoginHistoryListener
arguments: ["@service_container"]
tags:
- { name: kernel.event_listener, event: security.authentication.success, method: onSecurityAuthenticationSuccess }
- { name: kernel.event_listener, event: security.authentication.failure, method: onSecurityAuthenticationFailure }
- { name: kernel.event_listener, event: security.interactive_login, method: onSecurityInteractiveLogin }
Sama klasa ma:
namespace BDK\UserBundle\Listener;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\HttpFoundation\Session;
use BDK\UserBundle\Entity\User as User;
class LoginHistoryListener {
public function __construct ($serviceContainer)
{
$this->request = $serviceContainer->get('request');
$this->em = $serviceContainer->get('doctrine')->getEntityManager();
$this->logger = $serviceContainer->get('authlog');
$this->security = $serviceContainer->get('security.context');
}
public function onSecurityAuthenticationSuccess (Event $event)
{
$this->logger->info('onSecurityAuthenticationSuccess');
}
public function onSecurityAuthenticationFailure (Event $event)
{
$this->logger->info('onSecurityAuthenticationFailure');
}
}
...i niestety nie działa ani trochę. W debugerze pdo Events jest w "Not Called Listeners":
security.authentication.failure LoginHistoryListener::onSecurityAuthenticationFailure
security.authentication.success LoginHistoryListener::onSecurityAuthenticationSuccess
po prostu ani trochę to nie chce działać, nie potrafię w to zakląć ani trochę życia :-(
help?
P.S. Event security.interactive_login uruchamia się odpowiednią z metodą i ten działa tak jak powinien. Dalej po prostu nie mam władzy nad momentem kiedy ktoś mi się loguje ale bez powodzenia. O to rzecz się cała rozchodzi, jakby ktoś zapomniał. Chcę mieć informację, że ktoś się próbował logować ale mu nie wyszło.