/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * * @return mixed */ public function handle($request, Closure $next) { if ($this->alexaRequest->isAlexaRequest()) { return $this->sendRequestThroughRouter($request); } return $next($request); }
/** * @throws InvalidRequestTimestamp */ private function checkTimestampTolerance() { //If the timestamp tolerance is set to 0 we'll skip the check (see config) if (array_get($this->config, 'timestampTolerance') === 0) { return; } $timestampTolerance = array_get($this->config, 'timestampTolerance'); $timestamp = $this->alexaRequest->getTimestamp(); if (time() - $timestamp > $timestampTolerance) { throw new InvalidRequestTimestamp("The request timestamp is older then configured timestamp tolerances allow"); } }
private function setupSession() { $this->session = $this->alexaRequest->getSession(); }