TokenProcessor.php 842 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Bridge\Monolog\Processor;
  11. use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
  12. /**
  13. * Adds the current security token to the log entry.
  14. *
  15. * @author Dany Maillard <danymaillard93b@gmail.com>
  16. * @author Igor Timoshenko <igor.timoshenko@i.ua>
  17. */
  18. class TokenProcessor extends AbstractTokenProcessor
  19. {
  20. /**
  21. * {@inheritdoc}
  22. */
  23. protected function getKey(): string
  24. {
  25. return 'token';
  26. }
  27. /**
  28. * {@inheritdoc}
  29. */
  30. protected function getToken(): ?TokenInterface
  31. {
  32. return $this->tokenStorage->getToken();
  33. }
  34. }