Esempio n. 1
1
 public function handle($request, Closure $next)
 {
     /*        if (Session::token() !== Input::get('_token')) {
             // throw new Illuminate\Session\TokenMismatchException;
                 return Redirect::back()->withMessage('stop wiggling wit h my token');
             }*/
     return parent::handle($request, $next);
 }
Esempio n. 2
1
 public function handle($request, \Closure $next)
 {
     try {
         return parent::handle($request, $next);
     } catch (TokenMismatchException $e) {
         return $this->unauthorizedResponse();
     }
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!\Request::is('ws/*') && !\Request::ajax()) {
         return parent::handle($request, $next);
     }
     return $this->addCookieToResponse($request, $next($request));
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ('testing' !== app()->environment()) {
         return parent::handle($request, $next);
     }
     return $next($request);
 }
Esempio n. 5
0
 /**
  * {@inheritDoc}
  */
 public function handle($request, Closure $next)
 {
     if (is_api_request()) {
         return $this->addCookieToResponse($request, $next($request));
     }
     return parent::handle($request, $next);
 }
Esempio n. 6
0
 protected function tokensMatch($request)
 {
     if ($request->wantsJson()) {
         return true;
     }
     return parent::tokensMatch($request);
 }
 public function handle($request, Closure $next)
 {
     if (!$request->is("api/*")) {
         return parent::handle($request, $next);
     }
     return $next($request);
 }
Esempio n. 8
0
 /**
  * Add the CSRF token to the response cookies.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Illuminate\Http\Response  $response
  * @return \Illuminate\Http\Response
  */
 protected function addCookieToResponse($request, $response)
 {
     if ('array' !== config('session.driver')) {
         return parent::addCookieToResponse($request, $response);
     }
     return $response;
 }
 protected function shouldPassThrough($request)
 {
     if ($request->is('login') && $request->ajax()) {
         return true;
     }
     return parent::shouldPassThrough($request);
 }
Esempio n. 10
0
 /**
  * {@inheritDoc}
  */
 public function handle($request, Closure $next)
 {
     if (is_api_request()) {
         return $next($request);
     }
     return parent::handle($request, $next);
 }
Esempio n. 11
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->shouldIgnore($request)) {
         return $this->addCookieToResponse($request, $next($request));
     }
     return parent::handle($request, $next);
 }
Esempio n. 12
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($request->getRequestUri() == '/en/update/docs') {
         return $next($request);
     }
     return parent::handle($request, $next);
 }
Esempio n. 13
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($request->method() == 'POST') {
         return $next($request);
     }
     return parent::handle($request, $next);
 }
Esempio n. 14
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (\App::environment() == 'testing') {
         return $next($request);
     }
     return parent::handle($request, $next);
 }
Esempio n. 15
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $userKey = $request->input('_key');
     if ($userKey && !empty($userKey)) {
         $user = User::where('user_key', $userKey)->first();
         if (Auth::check()) {
             $prevuser = Auth::user();
             Auth::logout();
         }
         if ($user->exists()) {
             Auth::login($user);
             $response = $next($request);
             Auth::logout();
             if (isset($prevuser) && isset($prevuser->id)) {
                 Auth::login($prevuser);
             }
             return $response;
         } else {
             $response = $next($request);
         }
         if (isset($prevuser)) {
             Auth::login($prevuser);
         }
         return $response;
     }
     if ($request->is('api/v1/donate/ipn')) {
         return $next($request);
     }
     return parent::handle($request, $next);
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (strpos($request, 'infusion')) {
         return $this->addCookieToResponse($request, $next($request));
     }
     return parent::handle($request, $next);
 }
Esempio n. 17
0
 public function handle($request, Closure $next)
 {
     if ($request->ajax()) {
         return $next($request);
     }
     return parent::handle($request, $next);
 }
Esempio n. 18
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (strpos($request->getRequestUri(), 'queue') >= 0) {
         return $next($request);
     }
     return parent::handle($request, $next);
 }
Esempio n. 19
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure                 $next
  *
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($request->is('admin/upload')) {
         return $next($request);
     }
     return parent::handle($request, $next);
 }
Esempio n. 20
0
 /**
  * Handle an incoming request.
  *
  * @param \Illuminate\Http\Request $request
  * @param \Closure                 $next
  *
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($request instanceof Request) {
         return $next($request);
     }
     return parent::handle($request, $next);
 }
Esempio n. 21
0
 public function handle($request, Closure $next)
 {
     if (in_array($request->path(), $this->openRoutes)) {
         return $next($request);
     } else {
         return parent::handle($request, $next);
     }
 }
 public function handle($request, Closure $next)
 {
     // change to production url
     if ($request->url() == 'http://www.programmechameleon.com/mail/receive') {
         return $next($request);
     }
     return parent::handle($request, $next);
 }
Esempio n. 23
0
 public function handle($request, Closure $next)
 {
     // Checks if request is an ajax call
     if ($request->ajax()) {
         return $next($request);
     }
     return parent::handle($request, $next);
 }
Esempio n. 24
0
 protected function tokensMatch($request)
 {
     // Don't validate CSRF when testing.
     if (env('APP_ENV') === 'testing') {
         return true;
     }
     return parent::tokensMatch($request);
 }
Esempio n. 25
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure                 $next
  *
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     # Skip API related requests
     if ($request->expectsJson()) {
         return $next($request);
     }
     return parent::handle($request, $next);
 }
Esempio n. 26
0
 /**
  * Handle an incoming request.
  *
  * @param \Illuminate\Http\Request $request
  * @param \Closure                 $next
  *
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     // Do not perform CSRF checks for API requests
     if (preg_match('#^/api#', $request->path()) !== false) {
         return $next($request);
     }
     return parent::handle($request, $next);
 }
Esempio n. 27
0
 protected function tokensMatch($request)
 {
     $tokenMatch = parent::tokensMatch($request);
     if ($tokenMatch) {
         $request->session()->regenerateToken();
     }
     return $tokenMatch;
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     //TODO: armin, see how to include csrf into ajax request
     if ($request->path() == "notificationsRead") {
         return $next($request);
     }
     return parent::handle($request, $next);
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure                 $next
  *
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     try {
         return parent::handle($request, $next);
     } catch (TokenMismatchException $_ex) {
         return \Redirect::to('auth/login');
     }
 }
 /**
  * Determine if the session and input CSRF tokens match.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return bool
  */
 protected function tokensMatch($request)
 {
     $tokensMatch = true;
     if (Controller::wantsHtml()) {
         $tokensMatch = parent::tokensMatch($request);
     }
     return $tokensMatch;
 }