protected function beforeAction()
    {
        if (Lb::app()->isRest()) {
            $restConfig = Lb::app()->getRest()[$this->controller_id][$this->action_id];
            list($requestMethod, $authType) = $restConfig;

            $response = $this->response;

            //Set Auth Middleware
            $this->middleware['authMiddleware']['params'] = [
                'rest_config' => $restConfig,
                'request' => $this->request,
            ];
            $this->middleware['authMiddleware']['failureCallback'] = function () use ($response) {
                $response->response_unauthorized(401);
            };

            //Set Request Method Filter
            $this->middleware['requestMethodFilter']['params'] = [
                'request_method' => $requestMethod,
                'request' => $this->request,
            ];
            $this->middleware['requestMethodFilter']['failureCallback'] = function () use ($response) {
                $response->response_invalid_request(403);
            };

            //Set Rate Limit Filter
            if (array_key_exists($this->action_id, $this->rateLimitActions)) {
                $this->middleware['rateLimitFilter']['params'] = $this->rateLimitActions[$this->action_id];
                $this->middleware['rateLimitFilter']['failureCallback'] = function () use ($response) {
                    $response->response_invalid_request(403);
                };
            }
        } else {
            $this->response_invalid_request(403);
        }

        parent::beforeAction();
    }