entity_user; return $this->authService->getUser($username); // Load a User object from your data source or throw UsernameNotFoundException. // The $username argument may not actually be a username: // it is whatever value is being returned by the getUsername() // method in your User class. // throw new \Exception('TODO: fill in loadUserByUsername() inside '.__FILE__); } /** * Refreshes the user after being reloaded from the session. * * When a user is logged in, at the beginning of each request, the * User object is loaded from the session and then this method is * called. Your job is to make sure the user's data is still fresh by, * for example, re-querying for fresh User data. * * If your firewall is "stateless: true" (for a pure API), this * method is not called. * * @return UserInterface */ public function refreshUser(UserInterface $user) { $user = $this->_ctrlInstanceUser($user); return $this->loadUserByUsername($user->getUsername()); } private function _ctrlInstanceUser(UserInterface $user) { $entity_user = $this->entity_user; if (!$user instanceof $entity_user) { throw new UnsupportedUserException( sprintf('Instances of "%s" are not supported.', get_class($user)) ); } return $user; } /** * Tells Symfony to use this provider for this User class. */ public function supportsClass($class) { return AuthUser::class === $class; } }