liuggio / StatsDClientBundle

Easily monitor your symfony2 production env., with ready-to-use stats.
MIT License
164 stars 43 forks source link

No Authentication Provider found for token of class "Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken". #59

Open eMerzh opened 8 years ago

eMerzh commented 8 years ago

i was using the liuggio_stats_d_client.collector.user collector...

it worked find until i found that in my api for some reasons i got some 500 errors:

here is a summary of the stack trace... hope it helps

Symfony\Component\Security\Core\Exception\ProviderNotFoundException: No Authentication Provider found for token of class "Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken".
  File "/myapp/web/app.php", line 38, in null
    $response = $kernel->handle($request);
  File "/myapp/app/bootstrap.php.cache", line 2444, in handle
    return $this->getHttpKernel()->handle($request, $type, $catch);
  File "/myapp/app/bootstrap.php.cache", line 3222, in handle
    $response = parent::handle($request, $type, $catch);
  File "/myapp/app/bootstrap.php.cache", line 3071, in handle
    return $this->handleRaw($request, $type);
  File "/myapp/app/bootstrap.php.cache", line 3124, in handleRaw
    return $this->filterResponse($response, $request, $type);
  File "/myapp/app/bootstrap.php.cache", line 3129, in filterResponse
    $this->dispatcher->dispatch(KernelEvents::RESPONSE, $event);
  File "/myapp/app/cache/prod/classes.php", line 2577, in dispatch
    $this->doDispatch($listeners, $eventName, $event);
  File "/myapp/app/cache/prod/classes.php", line 2648, in doDispatch
    call_user_func($listener, $event, $eventName, $this);
  File "/myapp/vendor/liuggio/statsd-client-bundle/Liuggio/StatsDClientBundle/Listener/StatsDCollectorListener.php", line 81, in onKernelResponse
    $dataToSend = $this->collector->collect($master, $request, $event->getResponse(), $exception);
  File "/myapp/vendor/liuggio/statsd-client-bundle/Liuggio/StatsDClientBundle/Service/StatsDCollectorService.php", line 49, in collect
    $collector->collect($request, $response, $exception);
  File "/myapp/vendor/liuggio/statsd-client-bundle/Liuggio/StatsDClientBundle/StatsCollector/UserStatsCollector.php", line 31, in collect
    if ($this->getSecurityContext()->isGranted('IS_AUTHENTICATED_FULLY')) {
  File "/myapp/vendor/symfony/symfony/src/Symfony/Component/Security/Core/SecurityContext.php", line 102, in isGranted
    return $this->authorizationChecker->isGranted($attributes, $object);
  File "/myapp/app/cache/prod/classes.php", line 3693, in isGranted
    $this->tokenStorage->setToken($token = $this->authenticationManager->authenticate($token));
  File "/myapp/app/cache/prod/classes.php", line 3494, in authenticate
    $lastException = new ProviderNotFoundException(sprintf('No Authentication Provider found for token of class "%s".', get_class($token)));

if i disable this collector, everything fine