Authorities have warned in recent months of possible attacks in the U.S. by lone attackers and affiliates of Islamic State.