当前位置: 首页>>代码示例>>PHP>>正文


PHP Guard::onceBasic方法代码示例

本文整理汇总了PHP中Illuminate\Contracts\Auth\Guard::onceBasic方法的典型用法代码示例。如果您正苦于以下问题:PHP Guard::onceBasic方法的具体用法?PHP Guard::onceBasic怎么用?PHP Guard::onceBasic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Contracts\Auth\Guard的用法示例。


在下文中一共展示了Guard::onceBasic方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->onceBasic()) {
         return response(['status' => false, 'message' => 'Unauthorized'], 401, ['WWW-Authenticate' => 'Basic']);
     }
     return $next($request);
 }
开发者ID:kfuchs,项目名称:Laravel-5-Bootstrat-REST-API,代码行数:14,代码来源:AuthenticateOnce.php

示例2: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $fails = $this->auth->onceBasic();
     if ($fails) {
         return response()->json(['message' => 'You have not access to this kind of request', 'code' => 401], 401);
     }
     return $next($request);
 }
开发者ID:elrufoelrufo,项目名称:MyOwnAPI,代码行数:15,代码来源:OnceAuth.php

示例3: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $fallo = $this->auth->onceBasic();
     if ($fallo) {
         return response()->json(['msg' => 'Debes estar autenticado para realizar esta operacion', 'status' => 401], 401);
     }
     return $next($request);
 }
开发者ID:Badillo,项目名称:api-restful,代码行数:15,代码来源:OnceAuth.php

示例4: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $fallo = $this->auth->onceBasic();
     if ($fallo) {
         return response()->json(['data' => 'Se debe estar autenticado para realizar esta operación.'], 401);
     }
     return $next($request);
 }
开发者ID:zekinash,项目名称:RESTful-API,代码行数:15,代码来源:OnceAuth.php

示例5: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     // Change the auth from basic to oncBasic to force Laravel to ask about
     // credentials for every request
     $fails = $this->auth->onceBasic();
     if ($fails) {
         return response()->json(['message' => 'Not engough permissions', 'code' => '401'], 401);
     }
     return $next($request);
 }
开发者ID:hasanabb,项目名称:apicourse,代码行数:17,代码来源:OneceAuth.php

示例6: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure                 $next
  * @return void|mixed
  */
 public function handle(Request $request, Closure $next)
 {
     if (!$this->app->isDownForMaintenance()) {
         return $next($request);
     }
     if ($request->segment(1) == 'admin') {
         return $next($request);
     }
     if (in_array($request->getClientIp(), $this->config->get('streams::maintenance.ip_whitelist', []))) {
         return $next($request);
     }
     /* @var UserInterface $user */
     $user = $this->guard->user();
     if ($user && $user->isAdmin()) {
         return $next($request);
     }
     if ($user && $this->authorizer->authorize('streams::maintenance.access')) {
         return $next($request);
     }
     if (!$user && $this->config->get('streams::maintenance.auth')) {
         /* @var Response|null $response */
         $response = $this->guard->onceBasic();
         if (!$response) {
             return $next($request);
         }
         $response->setContent(view('streams::errors.401'));
         return $response;
     }
     abort(503);
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:37,代码来源:CheckForMaintenanceMode.php

示例7: handle

 /**
  * Handle an incoming request.
  *
  * @param \Illuminate\Http\Request $request
  * @param \Closure                 $next
  *
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->guest()) {
         if ($apiToken = $request->header('X-Gitamin-Token')) {
             try {
                 $this->auth->onceUsingId(User::findByApiToken($apiToken)->id);
             } catch (ModelNotFoundException $e) {
                 //
             }
         } elseif ($request->getUser()) {
             if ($this->auth->onceBasic() !== null) {
                 //
             }
         }
     }
     return $next($request);
 }
开发者ID:xiaobailc,项目名称:Gitamin,代码行数:25,代码来源:ApiOptionalAuthenticate.php

示例8: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     return $this->auth->onceBasic() ?: $next($request);
 }
开发者ID:andrelotto,项目名称:ApiCidadeEstadosIbge,代码行数:11,代码来源:StatelessBasicAuth.php

示例9: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     return $this->auth->onceBasic() ? response()->json(['error' => 'Can\'t login user'], 401) : $next($request);
 }
开发者ID:beazal,项目名称:kaloriju_skaiciuokle,代码行数:11,代码来源:MyBasicAuthenticate.php


注:本文中的Illuminate\Contracts\Auth\Guard::onceBasic方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。