This commit is contained in:
2026-03-04 01:58:26 +01:00
parent a7844c145a
commit c360663603
23 changed files with 1115 additions and 81 deletions

View File

@@ -22,6 +22,20 @@ if (defined('APP_BASIC_AUTH') && APP_BASIC_AUTH && !$isRetoolPath) {
}
}
// OIDC Auth
$publicPaths = [
'auth/login',
'auth/callback',
'auth/logout',
];
if (defined('APP_AUTH_ENABLED') && APP_AUTH_ENABLED && !in_array($uriPath, $publicPaths, true)) {
$user = auth_user();
if (!$user) {
header('Location: /auth/login', true, 302);
exit;
}
}
// Sicherheitscheck
if (str_contains($uriPath, '..')) {
http_response_code(400);
@@ -29,9 +43,23 @@ if (str_contains($uriPath, '..')) {
}
// Spezialrouten für Module
if (str_starts_with($uriPath, 'modules/setup/')) {
if (str_starts_with($uriPath, 'modules/install')) {
$target = __DIR__ . '/page/modules_install.php';
} elseif (str_starts_with($uriPath, 'modules/setup/')) {
$_GET['module'] = trim(substr($uriPath, strlen('modules/setup/')), '/');
$target = __DIR__ . '/page/modules_setup.php';
} elseif ($uriPath === 'auth/login') {
$target = __DIR__ . '/page/auth_login.php';
} elseif ($uriPath === 'auth/callback') {
$target = __DIR__ . '/page/auth_callback.php';
} elseif ($uriPath === 'auth/logout') {
$target = __DIR__ . '/page/auth_logout.php';
} elseif ($uriPath === 'settings') {
$target = __DIR__ . '/page/settings.php';
} elseif ($uriPath === 'users') {
$target = __DIR__ . '/page/users.php';
} elseif ($uriPath === 'debug') {
$target = __DIR__ . '/page/debug.php';
} elseif (preg_match('~^module/([a-zA-Z0-9_-]+)(?:/(.+))?$~', $uriPath, $m)) {
$module = $m[1];
$page = isset($m[2]) && $m[2] !== '' ? trim($m[2], '/') : 'index';