19 declare(strict_types=1);
40 if (!empty($config)) {
41 foreach ($config as
$key => $value) {
42 switch (strtolower(
$key)) {
49 case 'password_encoder':
52 case 'encoder_factory':
61 '"password_encoder" must be set in %s.',
62 print_r($config,
true)
68 '"encoder_factory" must be instance of ilUserPasswordEncoderFactory and set in %s.',
69 print_r($config,
true)
83 if (self::$instance instanceof
self) {
84 return self::$instance;
91 'default_password_encoder' =>
'bcryptphp',
92 'memory_cost' => 19_456,
93 'ignore_security_flaw' =>
true,
97 'password_encoder' =>
'argon2id',
98 'settings' => $DIC->isDependencyAvailable(
'settings') ? $DIC->settings() : null,
99 'db' => $DIC->database(),
103 self::$instance = $password_manager;
104 return self::$instance;
141 if ($encoder->requiresSalt()) {
165 if ($encoder->requiresReencoding($user->
getPasswd())) {
177 $defaultAuthMode = $this->
settings->get(
'auth_mode');
178 $defaultAuthModeCondition =
'';
180 $defaultAuthModeCondition =
' OR auth_mode = ' . $this->db->quote(
'default',
'text');
183 $this->db->manipulateF(
184 "UPDATE usr_data SET passwd_policy_reset = %s WHERE (auth_mode = %s $defaultAuthModeCondition)",
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
resetPassword(string $raw, string $raw_retype)
Resets the user password.
encodePassword(ilObjUser $user, string $raw)
__construct(array $config=[])
Please use the singleton method for instance creation The constructor is still public because of the ...
isEncodingTypeSupported(string $name)
setPasswordSalt(?string $password_salt)
ilUserPasswordEncoderFactory $encoderFactory
setPasswd(string $a_str, string $a_type=ilObjUser::PASSWD_PLAIN)
setSettings(?ilSetting $settings)
static getBytes(int $length)
Generate random bytes using OpenSSL or Mcrypt and mt_rand() as fallback.
setEncoderFactory(ilUserPasswordEncoderFactory $encoderFactory)
static getDataDir()
get data directory (outside webspace)
setPasswordEncodingType(?string $password_encryption_type)
verifyPassword(ilObjUser $user, string $raw)
resetLastPasswordChangeForLocalUsers()
getPasswordEncodingType()
static getInstance()
Singleton method to reduce footprint (included files, created instances)
setEncoderName(string $encoderName)