本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}