1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32:
<?php
namespace BaseModule\Services;
class Authenticator extends \Nette\Object implements \Nette\Security\IAuthenticator {
public function authenticate(array $credentials) {
list($username, $password) = $credentials;
if ($username != 'rpredictor') {
throw new \Nette\Security\AuthenticationException('Bad login name.', self::IDENTITY_NOT_FOUND);
}
if ($password != 'rpweb2014') {
throw new \Nette\Security\AuthenticationException('Bad password.', self::INVALID_CREDENTIAL);
}
return new \Nette\Security\Identity($username);
}
}