41        assert(
'is_array($info)');
 
   42        assert(
'is_array($config)');
 
   47        $this->users = array();
 
   49        if (!$htpasswd = file_get_contents(
$config[
'htpasswd_file'])) {
 
   50            throw new Exception(
'Could not read '.
$config[
'htpasswd_file']);
 
   53        $this->users = explode(
"\n", trim($htpasswd));
 
   57        } 
catch (Exception $e) {
 
   58            throw new Exception(
'Invalid static_attributes in authentication source '.
 
   59                $this->authId.
': '.$e->getMessage());
 
   82        assert(
'is_string($username)');
 
   83        assert(
'is_string($password)');
 
   85        foreach ($this->users as $userpass) {
 
   86            $matches = explode(
':', $userpass, 2);
 
   87            if ($matches[0] == $username) {
 
   88                $crypted = $matches[1];
 
   91                $attributes = array_merge(array(
'uid' => array($username)), $this->attributes);
 
   97                        'CRYPT authentication is insecure. Please consider using something else.' 
  103                if (APR1_MD5::check(
$password, $crypted)) {
 
  112                        'SHA1 and PLAIN TEXT authentication are insecure. Please consider using something else.' 
An exception for terminatinating execution or to throw for unit testing.
static normalizeAttributesArray($attributes)
Validate and normalize an array with attributes.
__construct($info, $config)
Constructor for this authentication source.
login($username, $password)
Attempt to log in using the given username and password.
Attribute-related utility methods.