From TNG 1x26 The Neutral Zone, Picard here is objecting to the 20th century guest Ralph Offenhouse pestering him over the com system :
PICARD: Those comm. panels are for official ship business.
RALPH: If they are so important, why don't they need an executive key?
PICARD: Aboard a starship, that is not necessary. We are all capable of exercising self-discipline. Now, you will refrain from using them.
Critical information is generally secured, however. From Data's Day (TNG 4x11), here T'Pel is a Romulan spy posing as a Vulcan Ambassador and tries to extract classified information from Data :
T’PEL: Enter. (Data Enters.) You have a priority three clearance aboard the Enterprise?
DATA : That is correct, Ambassador.
T'PEL : I require information on this ship's defense and navigational systems. Access code: kappa-alpha-4-6-0-1-7-0-4.
DATA : The code is valid.
T'PEL : What is the field strength of the ship's deflector shields at maximum output?
DATA : May I ask the purpose of your request?
T’PEL: I require this information.
DATA: I have the same safeguards as the ship's computer. Therefore, I must report any inquiry regarding restricted information to the Captain. Your reaction suggests you do not wish the Captain to be informed of your inquiry.
T’PEL: I was not interested in the information. I was curious as to your security safeguards. They appear to be adequate. Cancel request. You may leave. (Data leaves)
So the concept of security keys and authentication does exist in the Star Trek Universe, it's just reserved for critical secrets and safety systems, while for non-critical systems it seems that officer and crew training and protocol are deemed generally sufficient.
This isn't to say that everyone who came on board the Enterprise had free reign of the ship. In The Wounded (TNG 4x12), three Cardassians come on board to hunt for the rogue Starfleet ship USS Phoenix commanded by Ben Maxwell and serious consideration is given to the degree of freedom they should have while onboard :
PICARD: There will be three Cardassians transporting aboard. Their Captain, Gul Macet and two of his aides. My intention is to be as open as possible with them, allow them to share in our search for the Phoenix.
WORF: Sir, it is necessary to assign them a security detail.
PICARD: They're our guests, Mister Worf. I don't want them to feel like prisoners.
RIKER: I tend to agree with Mister Worf, Captain. I think we should limit their access while they're on board. They don't need to have the run of the ship.
WORF: At least allow me to post guards in some of the sensitive areas of the ship.
PICARD: Very well, let's limit their access. But you instruct your people they are guests.
WORF: Aye, sir.
And the Enterprise does have dynamic physical access controls in the form of force fields which are ubiquitous in every corridor (and double as safety systems in the case of hull breach). These are always used in reaction to a direct threat, however, and not generally for access control. We see these used many times - during the hunt for Roga Danar, for example, or when trying to apprehend the legacy Klingons in Heart of Glory.
Beyond TNG, we do see other examples where physical access to a computer terminal still requires authorization to access secured information. The holographic Doctor, for example, in Message In A Bottle (VOY 4x14) found himself on the prototype vessel USS Prometheus, which happens to have been commandeered by Romulans. As such, the Doctor's security clearances are not recognized and his access to information is very limited, even though he has easy physical access to the computer systems themselves :
EMH: Computer, is there any way for me to gain access to the communication system to send a message to another ship?
COMPUTER: Negative. Communications access requires level four clearance or above.
EMH: Computer, display the design schematic of this ship and list general specifications.
COMPUTER: USS Prometheus. Experimental prototype designed for deep space tactical assignments. Primary battle systems include regenerative shielding, ablative hull armour, multivector assault mode.
EMH: Multivector assault mode? Describe.
COMPUTER: Access to tactical data requires level four clearance.
EMH: What can you show me at my clearance level?!
As for locking doors, it is possible, but seems rarely used (for the self-discipline reasons noted above). From the same episode (VOY 4x14) we hear B'Elanna complaining about Seven of Nine having locked others out of astrometrics:
CHAKOTAY: Part of the problem is your attitude. You've never tried to accept Seven as part of the crew.
TORRES: And with good reason. Guess what she did this morning. She took an isolinear processor out of Engineering without asking, and when I went to Astrometrics to get it back she had locked the door, like that lab is her own private domain.
CHAKOTAY: What do you want me to do? Throw her in the brig for the rest of the trip home?