loadUserByIdentifier($username); } /** * 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. */ public function refreshUser(UserInterface $user): UserInterface { if (!$user instanceof ) { throw new UnsupportedUserException(sprintf('Invalid user class "%s".', $user::class)); } // Return a User object after making sure its data is "fresh". // Or throw a UsernameNotFoundException if the user no longer exists. throw new \Exception('TODO: fill in refreshUser() inside '.__FILE__); } /** * Tells Symfony to use this provider for this User class. */ public function supportsClass(string $class): bool { return ::class === $class || is_subclass_of($class, ::class); } /** * Upgrades the hashed password of a user, typically for using a better hash algorithm. */ public function upgradePassword(PasswordAuthenticatedUserInterface $user, string $newHashedPassword): void { // TODO: when hashed passwords are in use, this method should: // 1. persist the new password in the user storage // 2. update the $user object with $user->setPassword($newHashedPassword); } }