Of course, it is allowed to ask for the passport of any passenger as Commander.
You are the highest authority onboard, AND the legal representative of state of registration.
However, you can not confiscate the passport. You obviously do need to hand over the passport to the authorities or passenger after the flight.