当前位置: 首页>>代码示例>>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;未经允许,请勿转载。