2015-03-08 18:53:08 +01:00
|
|
|
<?php
|
|
|
|
|
2016-12-29 06:43:02 +01:00
|
|
|
namespace PHPCensor\Security\Authentication\UserProvider;
|
2015-03-08 18:53:08 +01:00
|
|
|
|
2016-12-29 06:43:02 +01:00
|
|
|
use PHPCensor\Model\User;
|
2017-01-22 12:05:24 +01:00
|
|
|
use PHPCensor\Security\Authentication\LoginPasswordProviderInterface;
|
2015-03-08 18:53:08 +01:00
|
|
|
|
|
|
|
/**
|
2016-12-29 06:43:02 +01:00
|
|
|
* Internal user provider
|
|
|
|
*
|
|
|
|
* @author Adirelle <adirelle@gmail.com>
|
2015-03-08 18:53:08 +01:00
|
|
|
*/
|
2017-01-22 12:05:24 +01:00
|
|
|
class Internal extends AbstractProvider implements LoginPasswordProviderInterface
|
2015-03-08 18:53:08 +01:00
|
|
|
{
|
2017-11-05 15:48:36 +01:00
|
|
|
/**
|
|
|
|
* @param User $user
|
|
|
|
* @param string $password
|
|
|
|
*
|
|
|
|
* @return boolean
|
|
|
|
*/
|
2015-03-08 18:53:08 +01:00
|
|
|
public function verifyPassword(User $user, $password)
|
|
|
|
{
|
|
|
|
return password_verify($password, $user->getHash());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function checkRequirements()
|
|
|
|
{
|
|
|
|
// Always fine
|
|
|
|
}
|
|
|
|
|
2017-11-05 15:48:36 +01:00
|
|
|
/**
|
|
|
|
* @param string $identifier
|
|
|
|
*
|
|
|
|
* @return null
|
|
|
|
*/
|
2015-03-08 18:53:08 +01:00
|
|
|
public function provisionUser($identifier)
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|