當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Middleware\VerifyCsrfToken類代碼示例

本文整理匯總了PHP中Illuminate\Foundation\Http\Middleware\VerifyCsrfToken的典型用法代碼示例。如果您正苦於以下問題:PHP VerifyCsrfToken類的具體用法?PHP VerifyCsrfToken怎麽用?PHP VerifyCsrfToken使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了VerifyCsrfToken類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: handle

 public function handle($request, \Closure $next)
 {
     try {
         return parent::handle($request, $next);
     } catch (TokenMismatchException $e) {
         return $this->unauthorizedResponse();
     }
 }
開發者ID:deadem,項目名稱:djem,代碼行數:8,代碼來源:VerifyCsrfToken.php

示例2: handle

 /**
  * 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));
 }
開發者ID:bilel99,項目名稱:tetris_webservice,代碼行數:14,代碼來源:VerifyCsrfToken.php

示例3: handle

 /**
  * 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);
 }
開發者ID:berkapavel,項目名稱:Laravel5-Time-Tracker-Project-manager,代碼行數:14,代碼來源:VerifyCsrfToken.php

示例4: handle

 /**
  * {@inheritDoc}
  */
 public function handle($request, Closure $next)
 {
     if (is_api_request()) {
         return $this->addCookieToResponse($request, $next($request));
     }
     return parent::handle($request, $next);
 }
開發者ID:hongpyo,項目名稱:l5essential,代碼行數:10,代碼來源:VerifyCsrfToken.php

示例5: tokensMatch

 protected function tokensMatch($request)
 {
     if ($request->wantsJson()) {
         return true;
     }
     return parent::tokensMatch($request);
 }
開發者ID:Rhincodon,項目名稱:test-laravel,代碼行數:7,代碼來源:VerifyCsrfToken.php

示例6: handle

 public function handle($request, Closure $next)
 {
     if (!$request->is("api/*")) {
         return parent::handle($request, $next);
     }
     return $next($request);
 }
開發者ID:Insantani,項目名稱:SourceTree-diovi,代碼行數:7,代碼來源:VerifyCsrfToken.php

示例7: addCookieToResponse

 /**
  * 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;
 }
開發者ID:BePsvPT,項目名稱:CCU,代碼行數:14,代碼來源:VerifyCsrfToken.php

示例8: shouldPassThrough

 protected function shouldPassThrough($request)
 {
     if ($request->is('login') && $request->ajax()) {
         return true;
     }
     return parent::shouldPassThrough($request);
 }
開發者ID:MetropoliaUAS,項目名稱:ISDProject-Online,代碼行數:7,代碼來源:VerifyCsrfToken.php

示例9: handle

 /**
  * {@inheritDoc}
  */
 public function handle($request, Closure $next)
 {
     if (is_api_request()) {
         return $next($request);
     }
     return parent::handle($request, $next);
 }
開發者ID:linuxssm,項目名稱:l5essential,代碼行數:10,代碼來源:VerifyCsrfToken.php

示例10: handle

 /**
  * 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);
 }
開發者ID:devisephp,項目名稱:cms,代碼行數:14,代碼來源:VerifyCsrfToken.php

示例11: handle

 /**
  * 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);
 }
開發者ID:Houbsi,項目名稱:Website,代碼行數:14,代碼來源:VerifyCsrfToken.php

示例12: handle

 /**
  * 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);
 }
開發者ID:lanhongjie,項目名稱:todoApp,代碼行數:14,代碼來源:VerifyCsrfToken.php

示例13: handle

 /**
  * 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);
 }
開發者ID:hlmasterchief,項目名稱:plock,代碼行數:14,代碼來源:VerifyCsrfToken.php

示例14: handle

 /**
  * 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);
 }
開發者ID:RobinJ1995,項目名稱:VacStatus,代碼行數:37,代碼來源:VerifyCsrfToken.php

示例15: handle

 /**
  * 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);
 }
開發者ID:keiwerkgvr,項目名稱:salesperformanceindicator,代碼行數:14,代碼來源:VerifyCsrfToken.php


注:本文中的Illuminate\Foundation\Http\Middleware\VerifyCsrfToken類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。