I honestly don't think he was confronting you or was trying to embarrass you in any way. Quite on the contrary, I think he was trying to be helpful by pointing something out to you, albeit the way he expressed himself was a bit blunt. However, the intention behind his comment seems to be out of his concern, perhaps, for safety.
This is like anything else, if someone makes a comment that seems to be blunt to you, don't take it at face value and feel insulted right away. You have a responsibility to communicate back and ask them to clarify in order to find out the real intention or message behind their comments. Some people's communication style can be very straight and to-the-point, don't be put off by that. Communication is a two way street, you need to be an active participant in it as well, running away feeling hurt won't solve the problem.
And please, don't use words like "discrimination" or "harassment" so lightly. Most of the problems come down to people not knowing how to communicate effectively, they have nothing to do with discrimination or harassment.