I always resort to passive aggression, because one, I don't like being in conflicts, and two, I'm afraid of losing my job for something like that. And it always happens when I least expect it. Like a customer asks for something in a nice voice, I try to help them in a nice way, and then boom, suddenly I'm being insulted because I couldn't get them what they wanted, or something like that.
I know it's hard to do sometimes, but I make sure that last thing I do is smile at them and tell them to "Have a nice day".
Not much pisses off a rude customer more than letting them think and see, that their rude/obscene behavior hasn't ruined your day.
If it is just some policy issue that I know that I'm right about, I just re-state said policy like someone above said and tell them to have a good day. Like someone else said, nothing irks a rude customer more than when a worker is unfazed by their rudeness.
2 Or 3 weeks ago, I had a guy get all pissed off at me because I ask for his I.D. for cough medicine. He looked older than 18 but young enough to card just in case. He got mad, said some things, went to his car to get his I.D., came back and said out loud in front of two of my managers that he could "steal this sh*t" if he wanted to and that the product was the best stuff out there implying that he was going to make some drug with it.
After the transaction processed, he told me that he would see me outside and I told him simply "Have a good day"
If the situation calls for it, I will defend myself against an absolutely abhorrent customer but even when you are face to face with the worst of the worst, you have to try to appear unfazed and not let it bug you.