core-bundle/src/Security/Authentication/Token/TokenChecker.php
public function hasBackendUser(): bool
    {
        $token = $this->getToken(BackendUser::SECURITY_SESSION_KEY);

        return null !== $token && $token->getUser() instanceof BackendUser;
    }
public function hasBackendUser(): bool
    {
        $token = $this->getToken(BackendUser::SECURITY_SESSION_KEY);

        return null !== $token && $token->getUser() instanceof BackendUser;
    }
Checks if a back end user is authenticated.