Use password_hash and password_verify

This commit is contained in:
Eric Lippmann 2018-05-08 09:06:19 +02:00
parent faaff42096
commit d6c4df7a5d

View File

@ -4,7 +4,6 @@
namespace Icinga\Authentication\User; namespace Icinga\Authentication\User;
use Exception; use Exception;
use Icinga\Authentication\PasswordHelper;
use Icinga\Data\Inspectable; use Icinga\Data\Inspectable;
use Icinga\Data\Inspection; use Icinga\Data\Inspection;
use Icinga\Data\Filter\Filter; use Icinga\Data\Filter\Filter;
@ -166,7 +165,7 @@ class DbUserBackend extends DbRepository implements UserBackendInterface, Inspec
*/ */
protected function persistPassword($value) protected function persistPassword($value)
{ {
return PasswordHelper::hash($value); return password_hash($value, PASSWORD_DEFAULT);
} }
/** /**
@ -213,7 +212,7 @@ class DbUserBackend extends DbRepository implements UserBackendInterface, Inspec
public function authenticate(User $user, $password) public function authenticate(User $user, $password)
{ {
try { try {
return PasswordHelper::verify( return password_verify(
$password, $password,
$this->getPasswordHash($user->getUsername()) $this->getPasswordHash($user->getUsername())
); );