public function loadUserByOAuthUserResponse(UserResponseInterface $response)
 {
     try {
         $user = $this->fosService->loadUserByUsername($response->getUsername());
     } catch (UsernameNotFoundException $e) {
         $user = $this->createNewUser($response->getUsername(), $response->getEmail(), $response);
     }
     return $user;
 }
Ejemplo n.º 2
0
 /**
  * @param SecurityUserInterface $user
  *
  * @return SecurityUserInterface
  * @throws UnsupportedUserException
  */
 public function refreshUser(SecurityUserInterface $user)
 {
     if ($this->stateless) {
         throw new UnsupportedUserException();
     }
     return parent::refreshUser($user);
 }
Ejemplo n.º 3
0
 /**
  * @expectedException \Symfony\Component\Security\Core\Exception\UnsupportedUserException
  */
 public function testRefreshInvalidUser()
 {
     $user = $this->getMock('Symfony\\Component\\Security\\Core\\User\\UserInterface');
     $this->userProvider->refreshUser($user);
 }