protected function _auth($user, $pass) { if (!Session::exists("auth")) { $auth = Request::auth(); if (is_null($auth) || $auth["user"] !== $user || $auth["pass"] !== $pass) { Response::setHeader('WWW-Authenticate: Basic realm="' . Config::$realm . '"'); return false; } Session::set("auth", true); } return true; }
public function auth() { $auth = Request::auth(); return !(is_null($auth) || $auth["user"] !== Config::$apiUser || $auth["pass"] !== Config::$apiPass); }