PasswordHashFactory

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

Table of Contents

Methods

get()  : PasswordHashInterface
Find a hash class that handles given hash and return an instance of it.
getDefaultHashInstance()  : PasswordHashInterface
Determine configured default hash method and return an instance of the class representing it.
getRegisteredSaltedHashingMethods()  : array<string|int, mixed>
Returns list of all registered hashing methods. Used eg. in extension configuration to select the default hashing method.

Methods

get()

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

public get(string $hash, string $mode) : PasswordHashInterface
Parameters
$hash : string

Given hash to find instance for

$mode : string

'FE' for frontend users, 'BE' for backend users

Tags
throws
LogicException
throws
InvalidArgumentException
throws
InvalidPasswordHashException

If no class was found that handles given hash

Return values
PasswordHashInterface

Object that can handle given hash

getDefaultHashInstance()

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

public getDefaultHashInstance(string $mode) : PasswordHashInterface
Parameters
$mode : string

'FE' for frontend users, 'BE' for backend users

Tags
throws
InvalidArgumentException
throws
LogicException
throws
InvalidPasswordHashException

If configuration is broken

Return values
PasswordHashInterface

Class instance that is configured as default hash method

getRegisteredSaltedHashingMethods()

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

public static getRegisteredSaltedHashingMethods() : array<string|int, mixed>
Tags
throws
RuntimeException
Return values
array<string|int, mixed>

        
On this page

Search results