/**
  * @expectedException \Symfony\Component\Security\Core\Exception\UnsupportedUserException
  */
 public function testRefreshInvalidUserClass()
 {
     $user = $this->createMock('FOS\\UserBundle\\Model\\User');
     $providedUser = $this->createMock('FOS\\UserBundle\\Tests\\TestUser');
     $this->userManager->expects($this->atLeastOnce())->method('getClass')->will($this->returnValue(get_class($user)));
     $this->userProvider->refreshUser($providedUser);
 }
Esempio n. 2
0
 /**
  * {@inheritdoc}
  */
 public function loadUserByUsername($username)
 {
     /** @var User $user */
     $user = $this->userProvider->loadUserByUsername($username);
     if (!$user) {
         throw new UsernameNotFoundException(sprintf('El usuario "%s" no existe.', $username));
     }
     return $user;
 }
Esempio n. 3
0
 public function loadUserByUsername($username)
 {
     $parts = $this->emailParser->parse($username);
     $this->verifyDomain($parts['domain']);
     $user = parent::loadUserByUsername($username);
     return $user;
 }
Esempio n. 4
0
 /**
  * @param SecurityUserInterface $user
  *
  * @return SecurityUserInterface
  * @throws UnsupportedUserException
  */
 public function refreshUser(SecurityUserInterface $user)
 {
     if ($this->stateless) {
         throw new UnsupportedUserException();
     }
     return parent::refreshUser($user);
 }
Esempio n. 5
0
 /**
  * @DI\InjectParams({
  *     "userManager" = @DI\Inject("fos_user.user_manager")
  * })
  * 
  * {@inheritDoc}
  */
 public function __construct(UserManagerInterface $userManager)
 {
     parent::__construct($userManager);
 }
 /**
  * 
  * Class constructor
  * @param UserManagerInterface
  * @param ContainerInterface
  *
  */
 public function __construct(UserProviderInterface $userProvider, ContainerInterface $container)
 {
     parent::__construct($userProvider);
     $this->container = $container;
 }
Esempio n. 7
0
 /**
  * @expectedException Symfony\Component\Security\Core\Exception\UnsupportedUserException
  */
 public function testRefreshInvalidUser()
 {
     $user = $this->getMock('Symfony\\Component\\Security\\Core\\User\\UserInterface');
     $this->userProvider->refreshUser($user);
 }
Esempio n. 8
0
 /**
  * 
  * @param unknown $class
  */
 public function supportsClass($class)
 {
     return $this->userProvider->supportsClass($class);
 }
Esempio n. 9
0
 public function __construct(UserManagerInterface $userManager, EntityManager $em, TokenGenerator $tokenGenerator)
 {
     parent::__construct($userManager);
     $this->em = $em;
     $this->tokenGenerator = $tokenGenerator;
 }