Definition at line 12 of file Htpasswd.php.
◆ __construct()
sspmod_authcrypt_Auth_Source_Htpasswd::__construct |
( |
|
$info, |
|
|
|
$config |
|
) |
| |
Constructor for this authentication source.
- Parameters
-
array | $info | Information about this authentication source. |
array | $config | Configuration. |
- Exceptions
-
Exception | if the htpasswd file is not readable or the static_attributes array is invalid. |
Definition at line 39 of file Htpasswd.php.
References $config, $info, array, and SimpleSAML\Utils\Attributes\normalizeAttributesArray().
41 assert(
'is_array($info)');
42 assert(
'is_array($config)');
47 $this->users =
array();
49 if (!$htpasswd = file_get_contents(
$config[
'htpasswd_file'])) {
53 $this->users = explode(
"\n", trim($htpasswd));
58 throw new Exception(
'Invalid static_attributes in authentication source '.
59 $this->authId.
': '.$e->getMessage());
static normalizeAttributesArray($attributes)
Validate and normalize an array with attributes.
Create styles array
The data for the language used.
◆ login()
sspmod_authcrypt_Auth_Source_Htpasswd::login |
( |
|
$username, |
|
|
|
$password |
|
) |
| |
|
protected |
Attempt to log in using the given username and password.
On a successful login, this function should return the username as 'uid' attribute, and merged attributes from the configuration file. On failure, it should throw an exception. A SimpleSAML_Error_Error('WRONGUSERPASS') should be thrown in case of a wrong username OR a wrong password, to prevent the enumeration of usernames.
- Parameters
-
string | $username | The username the user wrote. |
string | $password | The password the user wrote. |
- Returns
- array Associative array with the users attributes.
- Exceptions
-
Definition at line 80 of file Htpasswd.php.
References $attributes, $password, array, SimpleSAML\Logger\debug(), and SimpleSAML\Logger\warning().
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];
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.'
Attribute-related utility methods.
Create styles array
The data for the language used.
◆ $attributes
sspmod_authcrypt_Auth_Source_Htpasswd::$attributes = array() |
|
private |
◆ $users
sspmod_authcrypt_Auth_Source_Htpasswd::$users |
|
private |
The documentation for this class was generated from the following file:
- libs/composer/vendor/simplesamlphp/simplesamlphp/modules/authcrypt/lib/Auth/Source/Htpasswd.php