PHP Class Webiny\Component\Security\Encoder\Encoder

This class loads the defined encoder and uses it to create a hash from the submitted password and verifies if it matches the password from the user provider.
Inheritance: use trait Webiny\Component\StdLib\StdLibTrait, use trait Webiny\Component\StdLib\FactoryLoaderTrait
Show file Open project: Webiny/Framework Class Usage Examples

Public Methods

Method Description
__construct ( string $driver, array | null $params = null )
createPasswordHash ( string $password ) : string Create a hash for the given password.
verifyPasswordHash ( string $password, string $hash ) : boolean Verify if the $password matches the $hash.

Method Details

__construct() public method

public __construct ( string $driver, array | null $params = null )
$driver string Name of the encoder provider class.
$params array | null Optional encoder params.

createPasswordHash() public method

Create a hash for the given password.
public createPasswordHash ( string $password ) : string
$password string
return string Password hash.

verifyPasswordHash() public method

Verify if the $password matches the $hash.
public verifyPasswordHash ( string $password, string $hash ) : boolean
$password string
$hash string
return boolean True if $password matches $hash. Otherwise false is returned.