A student has asked me this question of late and I was unable to provide anything solid, but promised I'd research it. Here's what I've found to be primary, likely just adding to what others have already posted.
Terry v. Ohio
Hibel v. Nevada (2004, in the 6th Judicial District Court)
Municipal codes may be present that also make it unlawful (Springfield's is 78-36 and/or 78-192)
I am not a lawyer folks, this is just what I've found so far on the matter.
Reasonable suspicion must be present. Then the LEO can ask you to identify yourself to ensure their own safety, check warrants, and rule the individual out for other crimes.
An example given to me by local PD was this: Person walking down the sidewalk, no reasonable suspicion, person tells cop to get bent (in a more vulgar way), LEO can ask for ID but the person can refuse and nothing can be done. BUT, if that person had been J-walking, reasonable suspicion exists at that point, LEO can ask for ID and the person can still refuse but it could be a criminally chargeable offense. This was under Hibel v. Nevada, US Supreme Court ruling.
The Hibel case harshly reemphasizes the Terry v. Ohio decision that reasonable suspicion must exist. The State v. Rankin case also adds to the issue folks.
http://en.wikipedia.org/wiki/Hiibel_v._Sixth_Judicial_District_Court_of_Nevada
http://www.law.cornell.edu/supct/html/03-5554.ZO.html (see section III)
Here's the State v. Waldrup case (2011) that was posted above.
http://www.courts.mo.gov/SUP/index.nsf/fe8feff4659e0b7b8625699f0079eddf/d51dca8d91764792862577c100726f43/$FILE/SC90978_Waldrup_reply_brief.pdf