| 1 | <?php |
||
| 7 | class Authenticator |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @var string |
||
| 11 | */ |
||
| 12 | protected $username; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * @var string |
||
| 16 | */ |
||
| 17 | protected $password; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @var string |
||
| 21 | */ |
||
| 22 | protected $sessionKey; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @var \Illuminate\Session\Store |
||
| 26 | */ |
||
| 27 | protected $session; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @param string $username |
||
| 31 | * @param string $password |
||
| 32 | * @param string $sessionKey |
||
| 33 | * @param \Illuminate\Session\Store $session |
||
| 34 | */ |
||
| 35 | public function __construct($username, $password, $sessionKey, Session $session) |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @return bool |
||
| 45 | */ |
||
| 46 | public function isAuthenticated() |
||
| 50 | |||
| 51 | /** |
||
| 52 | * @param array $credentials |
||
| 53 | * @return bool |
||
| 54 | */ |
||
| 55 | public function attempt($credentials) |
||
| 66 | |||
| 67 | /** |
||
| 68 | * @param array $credentials Format: ['username' => '...', 'password' => '...'] |
||
| 69 | * @return bool |
||
| 70 | */ |
||
| 71 | protected function validateCredentials($credentials) |
||
| 79 | |||
| 80 | protected function login() |
||
| 84 | |||
| 85 | public function logout() |
||
| 89 | } |
||
| 90 |