visual
All checks were successful
Deploy / deploy-staging (push) Successful in 25s
Deploy / deploy-production (push) Has been skipped

This commit is contained in:
2026-08-14 01:24:24 +02:00
parent 97e5a2e2da
commit 6de12f164d
5 changed files with 201 additions and 18 deletions

View File

@@ -17,8 +17,9 @@ $keycloakConfig = ConfigLoader::load($projectRoot, 'keycloak');
$registrationConfig = ConfigLoader::load($projectRoot, 'registration');
$auth = new KeycloakAuth($keycloakConfig);
$accountGate = new AccountGate($registrationConfig);
$hasAuthenticatedSession = $auth->ensureAuthenticatedSession();
if (!$auth->isAuthenticated()) {
if (!$hasAuthenticatedSession) {
$statusRedirect = AuthStatusRedirect::consume();
if ($statusRedirect !== null) {
@@ -27,7 +28,7 @@ if (!$auth->isAuthenticated()) {
}
}
if ($auth->isAuthenticated()) {
if ($hasAuthenticatedSession) {
$currentUser = is_array($_SESSION['desktop_auth']['user'] ?? null) ? $_SESSION['desktop_auth']['user'] : [];
$accountCheck = $accountGate->checkUsername((string) ($currentUser['username'] ?? ''));
@@ -42,7 +43,7 @@ if ($auth->isAuthenticated()) {
}
if (
!$auth->isAuthenticated()
!$hasAuthenticatedSession
&& $auth->isConfigured()
&& empty($_SESSION['desktop_silent_sso_attempted'])
) {
@@ -51,6 +52,15 @@ if (
exit;
}
if (
!$hasAuthenticatedSession
&& $auth->isConfigured()
&& $auth->enforceLogin()
) {
header('Location: /auth/keycloak', true, 302);
exit;
}
$app = new App($projectRoot);
$desktopPayload = $app->desktopPayload();