Manipulate AuthUserFiles as used for HTTP Basic Authentication.
Usage Example:
1 $htp = &File_Passwd::factory('AuthBasic');
2 $htp->setMode('sha');
3 $htp->setFile('/www/mike/auth/.htpasswd');
4 $htp->setExePath('/usr/bin/htpasswd');
5 $htp->load();
6 $htp->addUser('mike', 'secret');
7 $htp->save();
NOTE: You usually need not set the full path to the htpasswd binary unless it's not in your $PATH. For use in safe_mode see "Limitations".
Output of listUser()
array + user => crypted_passwd + user => crypted_passwd
Limitations:
If you have "safe_mode" enabled you only can use DES encryption for your passwords. NOTE: If you're additionally on Win32 you even cannot use this class. This behavior derives from the unusual implementiation of the Apache's htpasswd encryption.
Located in Program_Root/Passwd/Authbasic.php (line 73)
File_Passwd_Common | --File_Passwd_Authbasic
Inherited from File_Passwd_Common
File_Passwd_Common::$_contents
File_Passwd_Common::$_users
Constructor
Add an user
The username must start with an alphabetical character and must NOT contain any other characters than alphanumerics, the underline and dash.
Returns a PEAR_Error if:
Change the password of a certain user
This method in fact adds the user with the new password after deleting it.
Returns a PEAR_Error if:
Get path to htpasswd executable if supplied earlier
Get actual encryption mode
Get supported encryption modes
array + md5 + sha + des
ATTN: DES encryption not available on Win32!
If you are on a Win32 plattform, the binary distribution of Apache's htpasswd executable doesn't support DES encryption.
Parse the AuthUserFile
Returns a PEAR_Error if AuthUserFile has invalid format.
Apply changes and rewrite AuthUserFile
Returns a PEAR_Error if:
Set path to htpasswd executable
NOTE: You usually don't need to set the complete path to the htpasswd binary unless it is NOT in your PATH!
Returns a PEAR_Error if supplied path doesn't map to a file or is not equal to 'htpasswd'. That's just if you want to reset this property to the default value.
Set the encryption mode
You can choose one of md5, sha or des.
ATTN: DES encryption not available on Win32!
If you are on a Win32 plattform, the binary distribution of Apache's htpasswd executable doesn't support DES encryption.
Returns a PEAR_Error if a specific encryption mode is not supported.
Verify password
ATTN: Not available with MD5 ecncryption!
If you use MD5 encryption you cannot verify your passwords. This depends on Apache's htpasswd binary, which uses a unusual format for MD5 passwords.
Returns a PEAR_Error if:
Constructor (ZE2)
Rewritten because DES encryption is not supportet by the Win32 htpasswd binary.
Inherited From File_Passwd_Common
File_Passwd_Common::delUser()
File_Passwd_Common::getFile()
File_Passwd_Common::listUser()
File_Passwd_Common::load()
File_Passwd_Common::parse()
File_Passwd_Common::save()
File_Passwd_Common::setFile()
File_Passwd_Common::userExists()
File_Passwd_Common::_close()
File_Passwd_Common::_open()
File_Passwd_Common::_save()
File_Passwd_Common::__clone()
File_Passwd_Common::__construct()
Documention generated on Sat, 20 Sep 2003 16:14:41 +0200 by phpDocumentor 1.2.1