Class File_Passwd_Authdigest

Description

Manipulate AuthDigestFiles as used for HTTP Digest Authentication.

Usage Example:


1 $htd = &File_Passwd::factory('Authdigest');
2 $htd->setFile('/www/mike/auth/.htdigest');
3 $htd->load();
4 $htd->addUser('mike', 'myRealm', 'secret');
5 $htd->save();

<kdb><u> Output of listUser() </u></kbd>

      array
       + user  => array
                   + realm => crypted_passwd
                   + realm => crypted_passwd
       + user  => array
                   + realm => crypted_passwd
 

Located in Program_Root/Passwd/Authdigest.php (line 55)

File_Passwd_Common
   |
   --File_Passwd_Authdigest
Method Summary
 File_Passwd_Authdigest File_Passwd_Authdigest ([string $file = '.htdigest'])
 mixed addUser (string $user, string $realm, string $pass)
 mixed changePasswd (string $user, string $realm, string $pass)
 mixed delUserInRealm (string $user, string $inRealm)
 array listUserInRealm ([string $inRealm = ''])
 mixed parse ()
 mixed save ()
 boolean userInRealm (string $user, string $realm)
 mixed verifyPasswd (string $user, string $realm, string $pass)
Variables
Methods
Constructor File_Passwd_Authdigest (line 71)

Constructor

  • access: public
File_Passwd_Authdigest File_Passwd_Authdigest ([string $file = '.htdigest'])
  • string $file: path to AuthDigestFile
addUser (line 118)

Add an user

Returns a PEAR_Error if:

  • the user already exists in the supplied realm
  • the user or realm contain illegal characters
$user and $realm must start with an alphabetical charachter and must NOT contain any other characters than alphanumerics, the underline and dash.

  • return: true on success or a PEAR_Error
  • access: public
  • throws: PEAR_Error
mixed addUser (string $user, string $realm, string $pass)
  • string $user: the user to add
  • string $realm: the realm the user should be in
  • string $pass: the plaintext password
changePasswd (line 201)

Change the password of a certain user

Returns a PEAR_Error if:

  • user doesn't exist in the supplied realm
  • user or realm contains illegal characters
This method in fact adds the user whith the new password after deleting the user.

  • return: true on success or a PEAR_Error
  • access: public
  • throws: PEAR_Error
mixed changePasswd (string $user, string $realm, string $pass)
  • string $user: the user whose password should be changed
  • string $realm: the realm the user is in
  • string $pass: the new plaintext password
delUserInRealm (line 252)

Delete a certain user in a specific realm

Returns a PEAR_Error if $user doesn't exist $inRealm.

  • return: true on success or PEAR_Error
  • access: public
  • throws: PEAR_Error
mixed delUserInRealm (string $user, string $inRealm)
  • string $user: the user to remove
  • string $inRealm: the realm the user should be in
listUserInRealm (line 168)

List all user of (a | all) realm(s)

Returns:

  • associative array of users of ONE realm if $inRealm was supplied <pre> realm1 + user1 + user2 + user3 </pre>
  • associative array of all realms with all users <pre> array + realm1 => array + user1 + user2 + user3 + realm2 => array + user3 + realm3 => array + user1 + user2 </pre>

  • access: public
array listUserInRealm ([string $inRealm = ''])
  • string $inRealm: the realm to list users of; if omitted, you'll get all realms
parse (line 269)

Parse the AuthDigestFile

Returns a PEAR_Error if AuthDigestFile has invalid format.

  • return: true on success or PEAR_Error
  • access: public
  • throws: PEAR_Error
mixed parse ()

Redefinition of:
File_Passwd_Common::parse()
Parse the content of the file
save (line 89)

Apply changes and rewrite AuthDigestFile

Returns a PEAR_Error if:

  • directory in which the file should reside couldn't be created
  • file couldn't be opened in write mode
  • file couldn't be locked exclusively
  • file couldn't be unlocked
  • file couldn't be closed

  • return: true on success or a PEAR_Error
  • access: public
  • throws: PEAR_Error
mixed save ()

Redefinition of:
File_Passwd_Common::save()
Apply changes and rewrite passwd file
userInRealm (line 237)

Ckeck if a certain user is in a specific realm

  • access: public
  • throws: PEAR_Error
boolean userInRealm (string $user, string $realm)
  • string $user: the user to check
  • string $realm: the realm the user shuold be in
verifyPasswd (line 221)

Verifiy password

Returns a PEAR_Error if the user doesn't exist in the supplied realm.

  • return: true if passwords equal, false if they don't, or PEAR_Error
  • access: public
  • throws: PEAR_Error
mixed verifyPasswd (string $user, string $realm, string $pass)
  • string $user: the user whose password should be verified
  • string $realm: the realm the user is in
  • string $pass: the plaintext password to verify

Inherited Methods

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:42 +0200 by phpDocumentor 1.2.1