PHP Class JeremyKendall\Password\Decorator\UpgradeDecorator

Inheritance: extends JeremyKendall\Password\Decorator\AbstractDecorator
Show file Open project: jeremykendall/password-validator Class Usage Examples

Protected Properties

Property Type Description
$validationCallback Legacy password validation via callback

Public Methods

Method Description
__construct ( JeremyKendall\Password\PasswordValidatorInterface $validator, callable $validationCallback ) Public constructor
isValid ( $password, $passwordHash, $legacySalt = null, $identity = null ) {@inheritDoc}

Private Methods

Method Description
createHashWhichWillForceRehashInValidator ( string $password ) : string This method returns an upgraded password, one that is hashed by the password_hash method in such a way that it forces the PasswordValidator to rehash the password. This results in PasswordValidator::isValid() returning a Result::$code of Result::SUCCESS_PASSWORD_REHASHED, notifying the StorageDecorator or custom application code that the returned password hash should be persisted.

Method Details

__construct() public method

Public constructor
public __construct ( JeremyKendall\Password\PasswordValidatorInterface $validator, callable $validationCallback )
$validator JeremyKendall\Password\PasswordValidatorInterface Password validator
$validationCallback callable Callback used to validate legacy password hash

isValid() public method

{@inheritDoc}
public isValid ( $password, $passwordHash, $legacySalt = null, $identity = null )

Property Details

$validationCallback protected property

Legacy password validation via callback
protected $validationCallback