Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
199 lars 1
<?php namespace Clockwork\Authentication;
2
 
3
class SimpleAuthenticator implements AuthenticatorInterface
4
{
5
	protected $password;
6
 
7
	public function __construct($password)
8
	{
9
		$this->password = $password;
10
	}
11
 
12
	public function attempt(array $credentials)
13
	{
14
		if (! isset($credentials['password'])) {
15
			return false;
16
		}
17
 
18
		if (! hash_equals($credentials['password'], $this->password)) {
19
			return false;
20
		}
21
 
22
		return password_hash($this->password, \PASSWORD_DEFAULT);
23
	}
24
 
25
	public function check($token)
26
	{
27
		return password_verify($this->password, $token);
28
	}
29
 
30
	public function requires()
31
	{
32
		return [ AuthenticatorInterface::REQUIRES_PASSWORD ];
33
	}
34
}