Пример #1
0
 /**
  * Call
  *
  * This method will check the HTTP request headers for previous
  * authentication. If the request has already authenticated, the next
  * middleware is called. Otherwise, a 401 Authentication Required response is
  * returned to the client.
  */
 public function call()
 {
     $reqURI = $this->app->request()->getResourceUri();
     if ($reqURI == '/login' || $reqURI == '/logout') {
         $this->next->call();
     } else {
         if (AppUtils::isLoggedIn()) {
             $this->next->call();
         } else {
             $res = $this->app->response();
             $res->status(401);
         }
     }
 }