vendor/scheb/2fa-bundle/Security/Authentication/AuthenticationTrustResolver.php line 26

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace Scheb\TwoFactorBundle\Security\Authentication;
  4. use Scheb\TwoFactorBundle\Security\Authentication\Token\TwoFactorTokenInterface;
  5. use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface;
  6. use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
  7. /**
  8.  * @final
  9.  */
  10. class AuthenticationTrustResolver implements AuthenticationTrustResolverInterface
  11. {
  12.     /**
  13.      * @var AuthenticationTrustResolverInterface
  14.      */
  15.     private $decoratedTrustResolver;
  16.     public function __construct(AuthenticationTrustResolverInterface $decoratedTrustResolver)
  17.     {
  18.         $this->decoratedTrustResolver $decoratedTrustResolver;
  19.     }
  20.     public function isAnonymous(TokenInterface $token null): bool
  21.     {
  22.         return $this->decoratedTrustResolver->isAnonymous($token);
  23.     }
  24.     public function isRememberMe(TokenInterface $token null): bool
  25.     {
  26.         return $this->decoratedTrustResolver->isRememberMe($token);
  27.     }
  28.     public function isFullFledged(TokenInterface $token null): bool
  29.     {
  30.         return !$this->isTwoFactorToken($token) && $this->decoratedTrustResolver->isFullFledged($token);
  31.     }
  32.     private function isTwoFactorToken(?TokenInterface $token): bool
  33.     {
  34.         return $token instanceof TwoFactorTokenInterface;
  35.     }
  36. }