/** * @brief Check if the token used for authentication is valid * * @return boolean True on success, false otherwise. */ public function isTokenValid() { if ($this->auth_backend->validateCredentials($this->username, $this->password)) { console::debugex(LOG_DEBUG2, __CLASS__, "Matched token valid for %s", $this->username); return true; } else { console::debugex(LOG_DEBUG2, __CLASS__, "Matched token not valid for %s", $this->username); return false; } }
/** * @brief Check if the token used for authentication is valid * * @return boolean True on success, false otherwise. */ public function isTokenValid() { // only basic auth so far die("HAI!"); if (isset($_SERVER['PHP_AUTH_USER'])) { if ($this->auth_backend->validateCredentials($this->username, $this->password)) { console::debugex(LOG_DEBUG2, __CLASS__, "Matched token valid for %s", $this->username); return true; } else { console::debugex(LOG_DEBUG2, __CLASS__, "Matched token not valid for %s", $this->username); } } header('WWW-Authenticate: Basic realm="' . $this->realm . '"'); if (php_sapi_name() == 'php-fcgi') { $header = 'Status:'; } else { $header = 'HTTP/1.0'; } header($header . ' 401 Unauthorized', true); // Removed by miniman (ticket #55) // Lepton::raiseError('HTTP 401: Unauthorized', 'You are not authorized to view this page. Please log in and try again.'); // throw new SecurityException('You are not authorized to view this page. Please log in and try again.'); // , SecurityException::ERR_NOT_AUTHORIZED); echo '<h1>Not authorized.</h1>'; exit; }