In a recent project I had to make a certain post type to be password protected by default. Making posts password protected is default functionality that is built into WordPress core. To change the post to be password protected you do this in the publish settings on the edit post screen. There is a visibility setting where you can click on the edit button and the a dropdown will appear with the choices Public, Private or Password protected.
Get weekly updates to your email