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 << - -
-Copyright (C) 2025 EmmeV. - Released under GNU AGPL 3.0 License.
- - -HTML; - exit; - } - } - } catch (Exception $e) { - http_response_code(500); - echo << - - -Copyright (C) 2025 EmmeV. - Released under GNU AGPL 3.0 License.
- - -HTML; - exit; - } -} ?> diff --git a/htdocs/admin/logout.php b/htdocs/admin/logout.php index 77c3478..1269459 100644 --- a/htdocs/admin/logout.php +++ b/htdocs/admin/logout.php @@ -2,7 +2,7 @@ include("../config/config.php"); session_start(); session_destroy(); -if (AUTH_TYPE === 'local' || AUTH_TYPE === 'google') +if (AUTH_TYPE === 'local') header("Location: /index.php"); else if (AUTH_TYPE === 'keycloak') header('Location: https://' + KEYCLOAK_DOMAIN + '/realms/' + KEYCLOAK_REALM + '/protocol/openid-connect/logout?post_logout_redirect_uri=https://' + APP_DOMAIN + '&client_id=' + KEYCLOAK_CLIENT_ID); diff --git a/htdocs/config/config.php b/htdocs/config/config.php index 43b0a26..c6fba37 100644 --- a/htdocs/config/config.php +++ b/htdocs/config/config.php @@ -24,7 +24,7 @@ if (!defined('DEV_MODE')) { } // Impostazioni autenticazione dashboard amministrativa if (!defined('AUTH_TYPE')) { - define('AUTH_TYPE','local'); // Può essere local (integrata), keycloak, google + define('AUTH_TYPE','local'); // Può essere local (integrata), keycloak } if (!defined('APP_DOMAIN')) { define('APP_DOMAIN',''); // Dominio del sito (ad esempio orario.yourdomain.com), richiesto per autenticazioni non local @@ -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