public function authenticate()
{
if (!empty($this->hashedPassword)) {
return $this->authenticateWithPassword($this->login, $this->getTokenAuthSecret());
} elseif (is_null($this->login)) {
return $this->authenticateWithToken($this->token_auth);
} elseif (!empty($this->login)) {
return $this->authenticateWithTokenOrHashToken($this->token_auth, $this->login);
}
return new AuthResult(AuthResult::FAILURE, $this->login, $this->token_auth);
}