Password Protecting Admin Functions in CakePHP
I just wanted to document this for easy future reference but if you don't want to hook up a complex user adminstration with authorization components, you can simply specify that the admin path be password protected in either your .htaccess file or in your httpd.conf. Many thanks to Dragos.
(This actually applies to password protecting any folder and not specific to CakePHP, I just happen to be using it for CakePHP.)
In your .htaccess file:
AuthUserFile /my/passwd/file AuthName "Title" AuthType Basic Require valid-user
Or in your httpd.conf (or similar apache configuration file):
<Location "/admin"> AuthType Basic AuthName "Title" AuthUserFile /my/passwd/file Require valid-user </Location>
If you need to generate the password file, you can do so with the following linux command:
htpasswd -c /my/passwd/file bob
Alternatively, you can use an online generator and copy the contents into a new file (useful if you have to FTP the password file).