/**
* Performs an authentication
* @param array
* @return Nette\Security\Identity
* @throws Nette\Security\AuthenticationException
*/
public function authenticate(array $credentials)
{
list($email, $password) = $credentials;
$user = $this->adminRepository->findOneBy(['email' => $email]);
if (!$user or !$this->passwordHasher->checkPassword($password, $user->getPassword())) {
throw new NS\AuthenticationException("Invalid credentials", self::FAILURE);
}
return $user;
}