2 namespace TYPO3\CMS\Saltedpasswords\Salt;
39 $saltMethods = static::getDefaultSaltMethods();
40 if (isset(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'ext/saltedpasswords'][
'saltMethods'])) {
41 $configuredMethods = (array)
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'ext/saltedpasswords'][
'saltMethods'];
42 if (!empty($configuredMethods)) {
43 if (isset($configuredMethods[0])) {
45 foreach ($configuredMethods as $method) {
46 $saltMethods[$method] = $method;
49 $saltMethods = array_merge($saltMethods, $configuredMethods);
64 \TYPO3\CMS\Saltedpasswords\Salt\Md5Salt::class => \TYPO3\CMS\Saltedpasswords\Salt\Md5Salt::class,
65 \TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt::class => \TYPO3\CMS\Saltedpasswords\Salt\BlowfishSalt::class,
66 \TYPO3\CMS\Saltedpasswords\Salt\PhpassSalt::class => \TYPO3\CMS\Saltedpasswords\Salt\PhpassSalt::class
89 if (!is_object(self::$instance) || !empty($saltedHash) || $saltedHash === null) {
91 if (!empty($saltedHash)) {
92 $result = self::determineSaltingHashingMethod($saltedHash, $mode);
94 self::$instance = null;
97 $classNameToUse = \TYPO3\CMS\Saltedpasswords\Utility\SaltedPasswordsUtility::getDefaultSaltingHashingMethod($mode);
98 $availableClasses = static::getRegisteredSaltedHashingMethods();
99 self::$instance = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($availableClasses[$classNameToUse]);
102 return self::$instance;
116 $registeredMethods = static::getRegisteredSaltedHashingMethods();
117 $defaultClassName = \TYPO3\CMS\Saltedpasswords\Utility\SaltedPasswordsUtility::getDefaultSaltingHashingMethod($mode);
118 $defaultReference = $registeredMethods[$defaultClassName];
119 unset($registeredMethods[$defaultClassName]);
121 $registeredMethods = array($defaultClassName => $defaultReference) + $registeredMethods;
122 $methodFound =
false;
123 foreach ($registeredMethods as $method) {
124 $objectInstance = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($method);
126 $methodFound = $objectInstance->isValidSaltedPW($saltedHash);
128 self::$instance = $objectInstance;
144 self::$instance = null;
145 $objectInstance = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($resource);
146 if (is_object($objectInstance) && is_subclass_of($objectInstance, \TYPO3\CMS\Saltedpasswords\Salt\AbstractSalt::class)) {
147 self::$instance = $objectInstance;
149 return self::$instance;