setAuthenticated() public method

public setAuthenticated ( $isAuthenticated )
Exemplo n.º 1
0
 public function testSetAuthenticatedToFalse()
 {
     $token = new UsernamePasswordToken('foo', 'bar', 'key');
     $token->setAuthenticated(false);
     $this->assertFalse($token->isAuthenticated());
 }
Exemplo n.º 2
0
 /**
  * It logs in the given user in the 'main' application firewall (or the
  * optionally given firewall name).
  *
  * @param UserInterface $user
  * @param string $firewallName
  *
  * @return UserInterface
  */
 public function login(UserInterface $user, $firewallName = 'main')
 {
     $token = new UsernamePasswordToken($user, $user->getPassword(), $firewallName, $user->getRoles());
     $token->setAuthenticated(true);
     $this->tokenStorage->setToken($token);
     $this->session->set('_security_' . $firewallName, serialize($token));
     $this->session->save();
     return $user;
 }
Exemplo n.º 3
0
 /**
  * Authenticate a user with Symfony Security
  *
  * @param Boolean $reAuthenticate
  * @return null
  */
 protected function authenticateUser(UserInterface $user, $reAuthenticate = false)
 {
     $providerKey = $this->container->getParameter('fos_user.provider_key');
     $token = new UsernamePasswordToken($user, null, $providerKey, $user->getRoles());
     if (true === $reAuthenticate) {
         $token->setAuthenticated(false);
     }
     $this->container->get('security.context')->setToken($token);
 }