code: public function hasFrontendUser(): bool
      {
          $token = $this->getToken(FrontendUser::SECURITY_SESSION_KEY);
  
          return null !== $token && $token->getUser() instanceof FrontendUser;
      }
docs: Checks if a front end user is authenticated.