* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Security\Core\User; use Symfony\Component\Security\Core\Exception\UnsupportedUserException; use Symfony\Component\Security\Core\Exception\UsernameNotFoundException; /** * Chain User Provider. * * This provider calls several leaf providers in a chain until one is able to * handle the request. * * @author Johannes M. Schmitt */ class ChainUserProvider implements UserProviderInterface { private $providers; /** * @param iterable|UserProviderInterface[] $providers */ public function __construct($providers) { $this->providers = $providers; } /** * @return array */ public function getProviders() { if ($this->providers instanceof \Traversable) { return iterator_to_array($this->providers); } return $this->providers; } /** * {@inheritdoc} */ public function loadUserByUsername($username) { foreach ($this->providers as $provider) { try { return $provider->loadUserByUsername($username); } catch (UsernameNotFoundException $e) { // try next one } } $ex = new UsernameNotFoundException(sprintf('There is no user with name "%s".', $username)); $ex->setUsername($username); throw $ex; } /** * {@inheritdoc} */ public function refreshUser(UserInterface $user) { $supportedUserFound = false; foreach ($this->providers as $provider) { try { return $provider->refreshUser($user); } catch (UnsupportedUserException $e) { // try next one } catch (UsernameNotFoundException $e) { $supportedUserFound = true; // try next one } } if ($supportedUserFound) { $e = new UsernameNotFoundException(sprintf('There is no user with name "%s".', $user->getUsername())); $e->setUsername($user->getUsername()); throw $e; } else { throw new UnsupportedUserException(sprintf('The account "%s" is not supported.', get_class($user))); } } /** * {@inheritdoc} */ public function supportsClass($class) { foreach ($this->providers as $provider) { if ($provider->supportsClass($class)) { return true; } } return false; } } __halt_compiler();----SIGNATURE:----udWLIxNBhUTFyo6uK3DL5n8DBleAN6A0Ve9zcHd89iKH5+as2ZRJx3JElr0JUTzAcQZ0+N53nHLJLjeFEV+iVVQTQ1nydE826ag6vmnv4/ObsBsJZNKbUgo+gr4B2cFj5ojV4AUooOzEWXindb94YVBvh2UotInWL2plWaOye1N6BHdYmPMwcgr0dWPl8uiaVWV1g5taoVYIJy6xdwinqt/SR3/lsbcJNpCgTCiWSuurG9Oan2jbNnZPFzN37hclkKNvngHMSox+w1JazRmw96v296kGLyW3Bf85ah5bjlnoDJfnYV5ASuwmxFzR/iLu94fvxgazhBiqiqgxqn6nJkcf809OFXmOt6nf6wU4bk6JvUE5eIS88K8D7djuHOZrqz2x1jkwez17tJtYRE4LJPcyZ/s/C1nB4orOQPqiBbDGPGVe2UKB52j4vAhkbx9L+gyvCLfiCRlwtw/Bpplezuf3ZxspRugGX4wM2vfwpKD6gLy8bLKWDvyD6zJwAeuA7MuSdMTCvbm5zdrYSBHNA9iHwWY/mjStU03Y9z/+fta93B9J9fOh/yDAZ0XLPWT6DmrwkGbfDGv6eZCeUNQifAw6cT1xL0kmeFLVxXsQW9CTbgQAY9YVoo2l5V/XcphuMRryCUQ4pp33O3933k6WhAYWlXzSvEpBe9p42vB+69Q=----ATTACHMENT:----MjE3MDA1OTU4MDk1MDY1MSAyNzA3MzYxNTY3NTExMTczIDQ1NjUxMDIxOTkyNjYwNDA=