Police or security guards or even private citizens have the right to approach you and talk to you or even ask you a question but once they have determined that there is no problem, if you tell them that you don't want to be bothered, provided you have done nothing wrong, they are obliged to leave you alone. The onus is on the OTHER PERSON to prove within reason that you are doing something wrong.

A law abiding citizen of the US is not even obliged to carry identification or identify himself to law enforcement officers if he has done nothing wrong.
The only time he is required to carry his driver's license is when he is driving a vehicle on public roads. A normal person who has done nothing wrong, who has broken no laws and isn't threatening or hurting anybody has the right to walk down the street without being bothered. He doesn't even have to talk to anybody he doesn't want to.

Yes, I know that there are a lot of "Barney Fifes" out there and I know that there a lot of cops who think they are Dirty Harry, too. The truth is that they are the exception, not the rule. Guys like that don't last very long. They either burn themselves out, get fired or get elected to city council.

Yes, I have been face to face with a Barney Fife. Of course, I don't thumb my nose at people like that whether they are cops, security guards or not. Of course, I'm polite.
The stock response should be, "I'm sorry, officer, is there something wrong?" The next question should be, "Do you think I'm breaking the law?" If the answer is anything other than the affirmative, the next response would be, "Excuse me, officer, but I'm busy and I must be going, now." In such a case, if the officer does or says anything other than, "Good day," it is HE who is breaking the law. Every good cop has or should have had training to that effect. Yes, I know people have been killed by bad cops but incidents like that are pretty rare.

No, I'm not going to stand my ground on principle against some bad cop who is determined to have his way whether it is lawful or not but the principle that I am going to stand on is that it's not my responsibility to worry about people like that. I don't break the law (except, maybe, that speeding ticket) and I expect to be able to go about my business without being harassed. It is people like us; law abiding citizens who just want to take photographs; who need to collectively place the blame squarely at the feet of those responsible.

We are not wrong. They are.