My question involves police conduct in the State of: California.
Last weekend my GF and best friend went to the beach and I decided to be the designated driver and not drink that day. While at the Beach my GF and friend started drinking out of blue party cups within 2 hours of being there we get raided from all sides by Sheriff officers in ATV's. They immediately approached me and asked for my ID and I stated that it was inside my vehicle with our clothes. The officer said I was getting a ticket for drinking in public; (which i was not) my GF and friend were. I told the officer that I was not drinking he then demanded I give him my keys for my vehicle, and that I sit on the floor. I asked him for what purpose and he said he needed to retrieve our ID's, I offer to go with him and tell him exactly were they were. He then got in my face with a hostile demeanor and tone and told me to sit down. I then gave him my keys; and then he proceeded to search my vehicle up and down and since I had open containers in my vehicle I would be charge and cited, I told him that the cans were inside a bag with soda cans and gatorade bottles and they were for recycling purposes, plus they were in the back floor seats and some in the trunk. He said that he found them in the front seats and floor. That is when I told him that that was the reason I did not want him to search my car without me being there. The commanding officer was now present and only made eye contact with his officer and they left me alone. My question is this was it legal for the officer to take my keys and search my vehicle without my permission? and can I file a complaint against the officer for his unprofessional behaviour and conduct, not to mentioned his attempt to accuse me of having open alcoholic containers?