‪TYPO3CMS  9.5
TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashFactory Class Reference
Inheritance diagram for TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashFactory:
TYPO3\CMS\Saltedpasswords\Salt\SaltFactory

Public Member Functions

PasswordHashInterface get (string $hash, string $mode)
 
PasswordHashInterface getDefaultHashInstance (string $mode)
 

Static Public Member Functions

static array getRegisteredSaltedHashingMethods ()
 
static PasswordHashInterface null getSaltingInstance ($saltedHash='', $mode=TYPO3_MODE)
 
static bool determineSaltingHashingMethod (string $saltedHash, $mode=TYPO3_MODE)
 
static PasswordHashInterface null setPreferredHashingMethod (string $resource)
 

Static Protected Attributes

static PasswordHashInterface $instance
 

Detailed Description

Factory class to find and return hash instances of given hashed passwords and to find and return default hash instances to hash new passwords.

Definition at line 24 of file PasswordHashFactory.php.

Member Function Documentation

◆ determineSaltingHashingMethod()

static bool TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashFactory::determineSaltingHashingMethod ( string  $saltedHash,
  $mode = TYPO3_MODE 
)
static

Method tries to determine the salting hashing method used for given salt.

Method implicitly sets the instance of the found method object in the class property when found.

Parameters
string$saltedHash
string$mode‪(optional) The TYPO3 mode (FE or BE) saltedpasswords shall be used for
Returns
‪bool TRUE, if salting hashing method has been found, otherwise FALSE
Deprecated:
‪since TYPO3 v9, will be removed in TYPO3 v10.0

Definition at line 213 of file PasswordHashFactory.php.

References TYPO3\CMS\Core\Crypto\PasswordHashing\SaltedPasswordsUtility\getDefaultSaltingHashingMethod(), and TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashInterface\isAvailable().

Referenced by TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashFactory\getSaltingInstance().

◆ get()

PasswordHashInterface TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashFactory::get ( string  $hash,
string  $mode 
)

Find a hash class that handles given hash and return an instance of it.

Parameters
string$hash‪Given hash to find instance for
string$mode‪'FE' for frontend users, 'BE' for backend users
Returns
PasswordHashInterface Object that can handle given hash
Exceptions

Definition at line 44 of file PasswordHashFactory.php.

References $GLOBALS.

◆ getDefaultHashInstance()

PasswordHashInterface TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashFactory::getDefaultHashInstance ( string  $mode)

Determine configured default hash method and return an instance of the class representing it.

Parameters
string$mode‪'FE' for frontend users, 'BE' for backend users
Returns
PasswordHashInterface Class instance that is configured as default hash method
Exceptions

Definition at line 94 of file PasswordHashFactory.php.

References $GLOBALS.

◆ getRegisteredSaltedHashingMethods()

static array TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashFactory::getRegisteredSaltedHashingMethods ( )
static

◆ getSaltingInstance()

static PasswordHashInterface null TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashFactory::getSaltingInstance (   $saltedHash = '',
  $mode = TYPO3_MODE 
)
static

Obtains a salting hashing method instance.

This function will return an instance of a class that implements \TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashInterface

Use parameter NULL to reset the factory!

Parameters
string | null$saltedHash‪Salted hashed password to determine the type of used method from or NULL to reset to the default type
string$mode‪The TYPO3 mode (FE or BE) saltedpasswords shall be used for
Returns
‪PasswordHashInterface|null An instance of salting hash method class or null if given hash is not supported
Deprecated:
‪since TYPO3 v9, will be removed in TYPO3 v10.0

Definition at line 178 of file PasswordHashFactory.php.

References TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashFactory\$instance, TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashFactory\determineSaltingHashingMethod(), and TYPO3\CMS\Core\Crypto\PasswordHashing\SaltedPasswordsUtility\getDefaultSaltingHashingMethod().

Referenced by TYPO3\CMS\Core\Tests\UnitDeprecated\Crypto\PasswordHashing\PasswordHashFactoryTest\abstractComposedSaltBase64EncodeReturnsProperLength(), TYPO3\CMS\Core\Crypto\PasswordHashing\SaltedPasswordService\compareUident(), TYPO3\CMS\Core\Tests\UnitDeprecated\Crypto\PasswordHashing\PasswordHashFactoryTest\objectInstanceForPhpPasswordHashArgon2iSalts(), TYPO3\CMS\Core\Tests\UnitDeprecated\Crypto\PasswordHashing\PasswordHashFactoryTest\objectInstanceForPhpPasswordHashBcryptSalts(), and TYPO3\CMS\Core\Tests\UnitDeprecated\Crypto\PasswordHashing\PasswordHashFactoryTest\resettingFactoryInstanceSucceeds().

◆ setPreferredHashingMethod()

static PasswordHashInterface null TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashFactory::setPreferredHashingMethod ( string  $resource)
static

Method sets a custom salting hashing method class.

Parameters
string$resource‪Object resource to use (e.g. \TYPO3\CMS\Core\Crypto\PasswordHashing\BlowfishPasswordHash::class)
Returns
‪PasswordHashInterface|null An instance of salting hashing method object or null
Deprecated:
‪since TYPO3 v9, will be removed in TYPO3 v10.0

Definition at line 245 of file PasswordHashFactory.php.

References TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashFactory\$instance.

Member Data Documentation

◆ $instance

PasswordHashInterface TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashFactory::$instance
staticprotected

An instance of the salted hashing method. This member is set in the getSaltingInstance() function.

Deprecated:
‪since TYPO3 v9, will be removed in TYPO3 v10.0

Definition at line 32 of file PasswordHashFactory.php.

Referenced by TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashFactory\getSaltingInstance(), and TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashFactory\setPreferredHashingMethod().