Definition at line 13 of file Hash.php.
◆ __construct()
sspmod_authcrypt_Auth_Source_Hash::__construct |
( |
|
$info, |
|
|
|
$config |
|
) |
| |
Constructor for this authentication source.
- Parameters
-
array | $info | Information about this authentication source. |
array | $config | Configuration. |
- Exceptions
-
Exception | in case of a configuration error. |
Definition at line 32 of file Hash.php.
References $attributes, $config, $info, array, and SimpleSAML\Utils\Attributes\normalizeAttributesArray().
34 assert(
'is_array($info)');
35 assert(
'is_array($config)');
40 $this->users =
array();
44 if (!is_string($userpass)) {
45 throw new Exception(
'Invalid <username>:<passwordhash> for authentication source '.
46 $this->authId.
': '.$userpass);
49 $userpass = explode(
':', $userpass, 2);
50 if (count($userpass) !== 2) {
51 throw new Exception(
'Invalid <username>:<passwordhash> for authentication source '.
52 $this->authId.
': '.$userpass[0]);
54 $username = $userpass[0];
55 $passwordhash = $userpass[1];
60 throw new Exception(
'Invalid attributes for user '.$username.
61 ' in authentication source '.$this->authId.
': '.
65 $this->users[$username.
':'.$passwordhash] =
$attributes;
static normalizeAttributesArray($attributes)
Validate and normalize an array with attributes.
Create styles array
The data for the language used.
◆ login()
sspmod_authcrypt_Auth_Source_Hash::login |
( |
|
$username, |
|
|
|
$password |
|
) |
| |
|
protected |
Attempt to log in using the given username and password.
On a successful login, this function should return the users attributes. On failure, it should throw an exception. If the error was caused by the user entering the wrong username OR password, a SimpleSAML_Error_Error('WRONGUSERPASS') should be thrown.
The username is UTF-8 encoded, and the hash is base64 encoded.
- 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 86 of file Hash.php.
References $password, and SimpleSAML\Logger\debug().
88 assert(
'is_string($username)');
89 assert(
'is_string($password)');
91 foreach ($this->users as $userpass => $attrs) {
92 $matches = explode(
':', $userpass, 2);
93 if ($matches[0] === $username) {
Attribute-related utility methods.
◆ $users
sspmod_authcrypt_Auth_Source_Hash::$users |
|
private |
Our users, stored in an associative array.
The key of the array is "<username>:<passwordhash>", while the value of each element is a new array with the attributes for each user.
Definition at line 21 of file Hash.php.
The documentation for this class was generated from the following file:
- libs/composer/vendor/simplesamlphp/simplesamlphp/modules/authcrypt/lib/Auth/Source/Hash.php