From 721cfc386dcf7631975479465f31a577619b98b3 Mon Sep 17 00:00:00 2001 From: Vichingo455 Date: Thu, 30 Oct 2025 08:26:16 +0100 Subject: [PATCH] I don't care about Google SSO --- docker/php/config.php | 15 ------- htdocs/admin/login.php | 93 ---------------------------------------- htdocs/admin/logout.php | 2 +- htdocs/config/config.php | 17 +------- 4 files changed, 2 insertions(+), 125 deletions(-) diff --git a/docker/php/config.php b/docker/php/config.php index eaf47cf..059d377 100644 --- a/docker/php/config.php +++ b/docker/php/config.php @@ -44,19 +44,4 @@ if (AUTH_TYPE === 'keycloak') { define('KEYCLOAK_CLIENT_SECRET',''); // Client Secret per Keycloak (ad esempio abcdefghijklm) } } -// Impostazioni autenticazione con Google (richieste solo se AUTH_TYPE sta impostato su google) -if (AUTH_TYPE === 'google') { - if (!defined('GOOGLE_CLIENT_ID')) { - define('GOOGLE_CLIENT_ID',''); // Client ID fornito da Google - } - if (!defined('GOOGLE_CLIENT_SECRET')) { - define('GOOGLE_CLIENT_SECRET',''); // Client Secret fornito da Google - } - if (!defined('GOOGLE_ONLY_ALLOWED_DOMAINS')) { - define('GOOGLE_ONLY_ALLOWED_DOMAINS', false); // Attivare (impostare su true) per impostare restrizioni sui domini e-mail consentiti - } - if (!defined('GOOGLE_ALLOWED_DOMAINS')) { - define('GOOGLE_ALLOWED_DOMAINS', ['']); // Domini E-Mail consentiti. Serve abilitare l'opzione GOOGLE_ONLY_ALLOWED_DOMAINS - } -} ?> \ No newline at end of file diff --git a/htdocs/admin/login.php b/htdocs/admin/login.php index 2bfd153..1d8103f 100644 --- a/htdocs/admin/login.php +++ b/htdocs/admin/login.php @@ -113,97 +113,4 @@ HTML; exit; } } -else if (AUTH_TYPE === 'google') { - try { - $oidc = new OpenIDConnectClient( - 'https://accounts.google.com', - GOOGLE_CLIENT_ID, - GOOGLE_CLIENT_SECRET - ); - - $oidc->setRedirectURL(GOOGLE_REDIRECT_URI); - $oidc->addScope(['openid', 'email', 'profile']); - - // Callback da Google - if (isset($_GET['code'])) { - $oidc->authenticate(); - $email = $oidc->requestUserInfo('email'); - - $domain = substr(strrchr($email, "@"), 1); - - if (!GOOGLE_ONLY_ALLOWED_DOMAINS || in_array($domain, GOOGLE_ALLOWED_DOMAINS)) { - $_SESSION['admin'] = $email; - $_SESSION['auth_type'] = 'google'; - header("Location: index.php"); - exit; - } else { - http_response_code(403); - echo << - - - Login Admin - - - - - - - - -
-

Login Admin

-HTML; -echo "
Non sei autorizzato ad accedere a questa pagina
"; -echo << -

Copyright (C) 2025 EmmeV. - Released under GNU AGPL 3.0 License.

- - -HTML; - exit; - } - } - } catch (Exception $e) { - http_response_code(500); - echo << - - - Login Admin - - - - - - - - -