vendor/pimcore/pimcore/bundles/AdminBundle/EventListener/TwoFactorListener.php line 23

Open in your IDE?
  1. <?php
  2. /**
  3.  * Pimcore
  4.  *
  5.  * This source file is available under two different licenses:
  6.  * - GNU General Public License version 3 (GPLv3)
  7.  * - Pimcore Enterprise License (PEL)
  8.  * Full copyright and license information is available in
  9.  * LICENSE.md which is distributed with this source code.
  10.  *
  11.  * @copyright  Copyright (c) Pimcore GmbH (http://www.pimcore.org)
  12.  * @license    http://www.pimcore.org/license     GPLv3 and PEL
  13.  */
  14. namespace Pimcore\Bundle\AdminBundle\EventListener;
  15. use Pimcore\Tool\Session;
  16. use Scheb\TwoFactorBundle\Security\TwoFactor\Event\TwoFactorAuthenticationEvent;
  17. use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBagInterface;
  18. class TwoFactorListener
  19. {
  20.     public function onAuthenticationComplete(TwoFactorAuthenticationEvent $event)
  21.     {
  22.         // this session flag is set in \Pimcore\Bundle\AdminBundle\Security\Guard\AdminAuthenticator
  23.         // @TODO: check if there's a nicer way of doing this, actually it feels a bit like a hack :)
  24.         Session::useSession(function (AttributeBagInterface $adminSession) {
  25.             $adminSession->set('2fa_required'false);
  26.         });
  27.     }
  28. }