public function unauthorized($ask = false) { if ($ask) { header("WWW-Authenticate: Basic realm=\"{$this->realm}\""); } throw new RestException(401, "You are not authorized to access this resource."); }