From 1d914c4b5b35b1aac48c609c3323b3970ce2f498 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Thu, 8 Sep 2016 17:36:56 +0200 Subject: [PATCH] Added new parameter to configure the saml path in authentication setup (cherry picked from commit 63b19a6a549ae8df6b3b29c202031e7f6c18b9d4) --- pandora_console/include/functions_config.php | 6 ++++++ pandora_console/index.php | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index e8889a77bd..73be42986e 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -357,6 +357,8 @@ function config_update_config () { $error_update[] = __('User'); if (!config_update_value ('rintegria_pass', io_input_password(get_parameter ('rintegria_pass')))) $error_update[] = __('Password'); + if (!config_update_value ('saml_path', get_parameter ('saml_path'))) + $error_update[] = __('Saml path'); if (!config_update_value ('double_auth_enabled', get_parameter ('double_auth_enabled'))) $error_update[] = __('Double authentication'); if (!config_update_value ('session_timeout', get_parameter ('session_timeout'))) @@ -1260,6 +1262,10 @@ function config_process_config () { config_update_value ( 'rintegria_pass', ''); } + if (!isset ($config['saml_path'])) { + config_update_value ('saml_path', '/opt/'); + } + if (!isset ($config['integria_enabled'])) { config_update_value ( 'integria_enabled', '0'); } diff --git a/pandora_console/index.php b/pandora_console/index.php index f6daa6da70..ea7393e480 100755 --- a/pandora_console/index.php +++ b/pandora_console/index.php @@ -297,10 +297,12 @@ if (! isset ($config['id_user'])) { } else if (($config['auth'] == 'saml') && ($login_button_saml)) { include_once(ENTERPRISE_DIR . "/include/auth/saml.php"); + $saml_user_id = saml_process_user_login(); + $nick_in_db = $saml_user_id; if (!$nick_in_db) { - require_once('/opt/simplesamlphp/lib/_autoload.php'); + require_once($config['saml_path'] . 'simplesamlphp/lib/_autoload.php'); $as = new SimpleSAML_Auth_Simple('PandoraFMS'); $as->logout(); } @@ -517,7 +519,7 @@ if (isset ($_GET["bye"])) { unset($_SESSION['id_usuario']); unset($iduser); if ($config['auth'] == 'saml') { - require_once('/opt/simplesamlphp/lib/_autoload.php'); + require_once($config['saml_path'] . 'simplesamlphp/lib/_autoload.php'); $as = new SimpleSAML_Auth_Simple('PandoraFMS'); $as->logout(); }