PHP Interface JeremyKendall\Password\PasswordValidatorInterface

Mostrar archivo Open project: jeremykendall/password-validator Interface Usage Examples

Public Methods

Method Description
getOptions ( ) : array Gets options for password_hash function
isValid ( string $password, string $passwordHash, string $legacySalt = null, string $identity = null ) : JeremyKendall\Password\Result Validates password and rehashes if necessary.
rehash ( string $password ) : string Hashes password using password_hash. Uses PASSWORD_DEFAULT encryption.
setOptions ( array $options ) Set options for password_hash function

Method Details

getOptions() public method

Gets options for password_hash function
public getOptions ( ) : array
return array password_hash options

isValid() public method

Validates password and rehashes if necessary.
public isValid ( string $password, string $passwordHash, string $legacySalt = null, string $identity = null ) : JeremyKendall\Password\Result
$password string Password provided by user during login
$passwordHash string User's current hashed password
$legacySalt string OPTIONAL salt used in legacy password hashing
$identity string OPTIONAL unique user identifier
return JeremyKendall\Password\Result

rehash() public method

Hashes password using password_hash. Uses PASSWORD_DEFAULT encryption.
public rehash ( string $password ) : string
$password string Plain text password
return string Hashed password

setOptions() public method

Set options for password_hash function
See also: http://php.net/password_hash Please, don't create your own salt. Really, just don't. Review the documentation first if you feel you just gotta create your own salt.
public setOptions ( array $options )
$options array password_hash options