/** * Check if authentication requests is valide. * This function checks that headers contains the HTTP_X_FORWADED_FOR header. * If not, then if $_SERVER['REMOTE_ADDR'] matches to $_server_ip. * @return boolean */ public function checkLemonldapRequest () { if (!$this->_server_check) { return true; } $hn = 'HTTP_X_FORWARDED_FOR'; $hv = $this->_engine->getHeaderValue($hn); $succeed = false; if (($hv !== false && strcasecmp(trim($hv), $this->_server_ip) == 0) || strcasecmp($_SERVER['REMOTE_ADDR'], $this->_server_ip) == 0) { $succeed = true; } $this->_logger->info($succeed ? "SUCCEED" : "FAILED"); return $succeed; }