Without probably cause, demanding ID is not just a right the police have (in the sense of fundamental human rights, I'm not talking about case law here.) Demanding ID without probable cause (or more strictly, a warrant) is a violation of fourth amendments rights, and would make the cop who did it, if armed, a felon under USC 18-242.
There's a saying about how bad the german cops got in the nazi era that you may have heard "papers please"-- this is literally asking for someone's id, usually without cause.
It's a sign of a police state-- a classic one.