for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the feedback project.
*
* (c) Florian Moser <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Security;
use App\Model\PasswordContainer;
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\User\UserProviderInterface;
class PasswordContainerProvider implements UserProviderInterface
{
/**
* @var string
private $password;
public function __construct(string $password)
$this->password = $password;
}
/** *
* @param UserInterface $user
* @return UserInterface
public function refreshUser(UserInterface $user)
return $user;
* Loads the user for the given username.
* This method must throw UsernameNotFoundException if the user is not
* found.
* @param string $username The username
* @throws UsernameNotFoundException if the user is not found
public function loadUserByUsername($username)
return new PasswordContainer($this->password);
* Whether this provider supports the given user class.
* @param string $class
* @return bool
public function supportsClass($class)
return PasswordContainer::class === $class;