vendor/symfony/security-http/Authenticator/Passport/Credentials/PasswordCredentials.php line 26

Open in your IDE?
  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\Component\Security\Http\Authenticator\Passport\Credentials;
  11. use Symfony\Component\Security\Core\Exception\LogicException;
  12. /**
  13.  * Implements password credentials.
  14.  *
  15.  * These plaintext passwords are checked by the UserPasswordHasher during
  16.  * authentication.
  17.  *
  18.  * @author Wouter de Jong <wouter@wouterj.nl>
  19.  *
  20.  * @final
  21.  */
  22. class PasswordCredentials implements CredentialsInterface
  23. {
  24.     private $password;
  25.     private $resolved false;
  26.     public function __construct(string $password)
  27.     {
  28.         $this->password $password;
  29.     }
  30.     public function getPassword(): string
  31.     {
  32.         if (null === $this->password) {
  33.             throw new LogicException('The credentials are erased as another listener already verified these credentials.');
  34.         }
  35.         return $this->password;
  36.     }
  37.     /**
  38.      * @internal
  39.      */
  40.     public function markResolved(): void
  41.     {
  42.         $this->resolved true;
  43.         $this->password null;
  44.     }
  45.     public function isResolved(): bool
  46.     {
  47.         return $this->resolved;
  48.     }
  49. }