Police ARE allowed to conduct random traffic stops to ensure that a driver is licenced and that a vehicle is properly registered and insured. Police are NOT allowed to conduct random searches of the vehicle itself or its occupants, nor are passengers typically required to identify themselves. Its all very dependent on why you were stopped and what specific offence police are investigating.
Certain acts due grant police the authority to search vehicles without a warrant (i.e. liquor offences), so its important they explain why youre being stopped and if any search, etc. requires your consent.