Process the middleware.

@param HTTPRequest $request The incoming request.
@param callable    $next    The next middleware.

@return HTTPResponse
334189
public function process(HTTPRequest $request, callable $next)
    {
        // don't authenticate if being run from command line
        if (Director::is_cli()) {
            return $next($request);
        }

        try {
            $request = $this->authenticator->authenticate($request);

            // set the current user
            if ($userID = $request->getHeader('oauth_user_id')) {
                Security::setCurrentUser(Member::get()->byID($userID));
            }
        } catch (AuthenticationException $exception) {
            // for middleware do nothing
        } catch (DatabaseException $exception) {
            // db not ready, ignore
        }

        // Pass the request on to the next responder in the chain
        return $next($request);
    }
42705
public function process(ServerRequestInterface $request, RequestHandlerInterface $next): ResponseInterface
    {
        $response = $next->handle($request);

        if (\count($this->originHosts)) {
            $response = $response->withHeader(self::ORIGIN, implode(' ', $this->originHosts));
        }

        if (\count($this->allowHeaders)) {
            $response = $response->withHeader(self::HEADERS, implode(', ', $this->allowHeaders));
        }

        if (\count($this->allowMethods)) {
            $response = $response->withHeader(self::METHODS, implode(', ', $this->allowMethods));
        }

        return $response;
    }
462506
public function handle($request, HandlerInterface $next)
    {
        if ($this->isEmpty()) {
            return $request;
        }
        if ($this->shadow == false) {
            $bundle = clone $this;
            $bundle->store->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO | SplDoublyLinkedList::IT_MODE_DELETE);
            $this->shadow = true;

            return $next->handle($request, $bundle);
        }
        $handler = $this->frontPop();

        return $handler->handle($request, $this);
    }
362264
public function handleRequest(RequestInterface $request, callable $next, callable $first)
    {
        $request = $request->withHeader('Authorization', $this->header);

        return $next($request);
    }
1040215
public function handle($request, Closure $next)
    {
        $this->kernel->setClosure($next);

        return $this->middleware->handle($request);
    }
1280234
public function handle($request, Closure $next)
    {
        if ($this->shouldExecute($request)) {
            return $this->before($request, $next);
        }

        return $next($request);
    }
357119
public function handle($request, Closure $next)
    {
        $response = $next($request);

        $this->app->make('antares.messages')->save();

        return $response;
    }
1306203
public function handle(Request $request, Closure $next)
    {
        // Are we going to try and include embedded data?
        $this->response->getManager()->parseIncludes(explode(',', $request->get('include')));

        return $next($request);
    }
482879
public function handle($request, Closure $next)
    {
        if (auth()->guest() || !user()->hasRoles(['client', 'member'])) {
            return $next($request);
        }
        $this->beforeSendingThroughPipeline();
        $response = $next($request);
        $this->afterSendingThroughPipeline();

        return $response;
    }
585961
public function handle( $request, Closure $next )
	{
		if ( Framework::fw()->isDownForMaintenance() )
			throw new HttpException( 503 );

		return $next( $request );
	}
926386
public function handle($request, Closure $next)
    {
        if ($this->app->isDownForMaintenance()) {
            throw new HttpException(503);
        }

        return $next($request);
    }
101737
public function handle($request, Closure $next)
    {
        try {
            if ($this->validator->validateRequest($request)) {
                $this->app->singleton(LaravelExceptionHandler::class, function ($app) {
                    return $app[ExceptionHandler::class];
                });

                $request = $this->app->make(RequestContract::class)->createFromIlluminate($request);

                $this->events->dispatch(new RequestWasMatched($request, $this->app));

                return $this->sendRequestThroughRouter($request);
            }
        } catch (Exception $exception) {
            $this->exception->report($exception);

            return $this->exception->handle($exception);
        }

        return $next($request);
    }
461759
public function handle(Request $request, callable $next)
    {
        $response = $next($request);
        if ( is_string($response) ) {
            return new Response($response);
        }

        return $response;
    }
709275
public function handle($request, Closure $next)
    {
        $this->tracker->trackRequest($request);

        return $next($request);
    }
558093
public function handle($request, Closure $next)
    {
        $response = $next($request);

        $this->setting->save();

        return $response;
    }
1355865
public function handle($request, Closure $next)
    {
        $as = $request->input('_as');

        if ($this->authorize() && ! is_null($as)) {
            $this->auth->loginUsingId($as);

            return $this->response->redirectTo($request->url());
        }

        return $next($request);
    }
66213
public function handle($request, Closure $next)
    {
        if (! $this->isAllowed($request)) {
            throw new HttpException(403, 'This action is unauthorized.');
        }

        return $next($request);
    }