34 lines
1.1 KiB
PHP
34 lines
1.1 KiB
PHP
<?php
|
|
|
|
use Illuminate\Foundation\Application;
|
|
use Illuminate\Foundation\Configuration\Exceptions;
|
|
use Illuminate\Foundation\Configuration\Middleware;
|
|
use Illuminate\Support\Facades\Route;
|
|
|
|
return Application::configure(basePath: dirname(__DIR__))
|
|
->withRouting(
|
|
web: __DIR__.'/../routes/web.php',
|
|
then: function () {
|
|
// Implant C2: no CSRF / session
|
|
require __DIR__.'/../routes/c2.php';
|
|
|
|
// Admin UI: session + CSRF
|
|
Route::middleware('web')->group(base_path('routes/admin.php'));
|
|
},
|
|
commands: __DIR__.'/../routes/console.php',
|
|
health: '/up',
|
|
)
|
|
->withMiddleware(function (Middleware $middleware): void {
|
|
$middleware->validateCsrfTokens(except: [
|
|
'api/*',
|
|
'link/*',
|
|
]);
|
|
|
|
// Admin uses auth:admin; there is no default "login" route.
|
|
$middleware->redirectGuestsTo(fn () => route('admin.login'));
|
|
$middleware->redirectUsersTo(fn () => route('admin.home'));
|
|
})
|
|
->withExceptions(function (Exceptions $exceptions): void {
|
|
//
|
|
})->create();
|