‪TYPO3CMS  10.4
TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashFactory Class Reference

Public Member Functions

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

Static Public Member Functions

static array getRegisteredSaltedHashingMethods ()
 

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 26 of file PasswordHashFactory.php.

Member Function Documentation

◆ 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 38 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 88 of file PasswordHashFactory.php.

References $GLOBALS.

◆ getRegisteredSaltedHashingMethods()

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

Returns list of all registered hashing methods. Used eg. in extension configuration to select the default hashing method.

Returns
‪array
Exceptions

Definition at line 139 of file PasswordHashFactory.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Core\Tests\Unit\Crypto\PasswordHashing\PasswordHashFactoryTest\getRegisteredSaltedHashingMethodsReturnsRegisteredMethods(), and TYPO3\CMS\Core\Tests\Unit\Crypto\PasswordHashing\PasswordHashFactoryTest\getRegisteredSaltedHashingMethodsThrowsExceptionIfNoMethodIsConfigured().