示例#1
0
 public function validateCredentials(UserInterface $user, array $credentials)
 {
     if ($user->getUserName($credentials['username']) && $user->getPassword($credentials['password'])) {
         return true;
     }
     return false;
 }
示例#2
0
 /**
  * This is called when an authentication is successful.
  *
  * @param Request $request
  * @param UserInterface $user
  */
 public function set(Request $request, UserInterface $user)
 {
     $this->remove();
     if (!$this->isRememberMeRequested($request)) {
         return;
     }
     $expires = self::COOKIE_LIFETIME + time();
     $value = $this->generateCookieValue($user->getUsername(), $expires, $user->getPassword());
     $this->cookie->set($this->name, $value, $expires);
 }
 /**
  * {@inheritdoc}
  */
 public function validateCredentials(UserInterface $user, array $credentials)
 {
     return $this->encoder->verify($user->getPassword(), $credentials['password']);
 }
示例#4
0
 /**
  * Sets the user to be used.
  *
  * @param  UserInterface $user
  * @param  bool          $remember
  */
 public function setUser(UserInterface $user, $remember = false)
 {
     $this->handler->write($user->getId(), $remember);
     $this->user = $user;
 }