改进 token 认证
This commit is contained in:
parent
0097f2e739
commit
ecf813f1f6
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Middleware\JWTMiddleware;
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Foundation\Configuration\Exceptions;
|
||||
use Illuminate\Foundation\Configuration\Middleware;
|
||||
@ -7,11 +8,14 @@
|
||||
return Application::configure(basePath: dirname(__DIR__))
|
||||
->withRouting(
|
||||
web: __DIR__.'/../routes/web.php',
|
||||
api: __DIR__.'/../routes/api.php',
|
||||
commands: __DIR__.'/../routes/console.php',
|
||||
health: '/up',
|
||||
)
|
||||
->withMiddleware(function (Middleware $middleware) {
|
||||
//
|
||||
// $middleware->alias([
|
||||
// 'jwt' => JWTMiddleware::class
|
||||
// ]);
|
||||
})
|
||||
->withExceptions(function (Exceptions $exceptions) {
|
||||
//
|
||||
|
@ -40,6 +40,10 @@
|
||||
'driver' => 'session',
|
||||
'provider' => 'users',
|
||||
],
|
||||
'api' => [
|
||||
'driver' => 'jwt',
|
||||
// 'provider' => 'users',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|
@ -4,4 +4,13 @@
|
||||
'client_id' => env('OAUTH_CLIENT_ID'),
|
||||
'client_secret' => env('OAUTH_CLIENT_SECRET'),
|
||||
'discovery' => env('OAUTH_DISCOVERY_URL'),
|
||||
|
||||
// 如果启用,将拒绝不匹配的 aud
|
||||
'force_aud' => false,
|
||||
|
||||
// 信任 aud。默认为空,如果你允许其他应用调用 api,你可以填写。
|
||||
'trusted_aud' => [
|
||||
// 1,2,3
|
||||
11,
|
||||
],
|
||||
];
|
||||
|
Loading…
Reference in New Issue
Block a user