當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。