Merge branch 'ent-3090-Personalizacion-saml-2' into 'develop'

Added more parameters to SAML configuration

See merge request artica/pandorafms!2506
This commit is contained in:
Alejandro Fraguas 2019-07-09 13:18:12 +02:00
commit 26c606b0d5
3 changed files with 74 additions and 10 deletions

View File

@ -527,14 +527,6 @@ define('NODE_MODULE', 1);
define('NODE_PANDORA', 2);
define('NODE_GENERIC', 3);
// SAML attributes constants.
define('SAML_ROLE_AND_TAG', 'eduPersonEntitlement');
define('SAML_USER_DESC', 'commonName');
define('SAML_ID_USER_IN_PANDORA', 'eduPersonTargetedId');
define('SAML_GROUP_IN_PANDORA', 'schacHomeOrganization');
define('SAML_MAIL_IN_PANDORA', 'mail');
define('SAML_DEFAULT_PROFILES_AND_TAGS_FORM', 'urn:mace:rediris.es:entitlement:monitoring:');
// Other constants.
define('STATUS_OK', 0);
define('STATUS_ERROR', 1);

View File

@ -652,6 +652,42 @@ function config_update_config()
$error_update[] = __('Saml path');
}
if (!config_update_value('saml_source', get_parameter('saml_source'))) {
$error_update[] = __('Saml source');
}
if (!config_update_value('saml_user_id', get_parameter('saml_user_id'))) {
$error_update[] = __('Saml user id parameter');
}
if (!config_update_value('saml_mail', get_parameter('saml_mail'))) {
$error_update[] = __('Saml mail parameter');
}
if (!config_update_value('saml_group_name', get_parameter('saml_group_name'))) {
$error_update[] = __('Saml group name parameter');
}
if (!config_update_value('saml_attr_type', (bool) get_parameter('saml_attr_type'))) {
$error_update[] = __('Saml attr type parameter');
}
if (!config_update_value('saml_profiles_and_tags', get_parameter('saml_profiles_and_tags'))) {
$error_update[] = __('Saml profiles and tags parameter');
}
if (!config_update_value('saml_profile', get_parameter('saml_profile'))) {
$error_update[] = __('Saml profile parameters');
}
if (!config_update_value('saml_tag', get_parameter('saml_tag'))) {
$error_update[] = __('Saml tag parameter');
}
if (!config_update_value('saml_profile_tag_separator', get_parameter('saml_profile_tag_separator'))) {
$error_update[] = __('Saml profile and tag separator');
}
if (!config_update_value('double_auth_enabled', get_parameter('double_auth_enabled'))) {
$error_update[] = __('Double authentication');
}
@ -2364,6 +2400,42 @@ function config_process_config()
config_update_value('saml_path', '/opt/');
}
if (!isset($config['saml_source'])) {
config_update_value('saml_source', '');
}
if (!isset($config['saml_user_id'])) {
config_update_value('saml_user_id', '');
}
if (!isset($config['saml_mail'])) {
config_update_value('saml_mail', '');
}
if (!isset($config['saml_group_name'])) {
config_update_value('saml_group_name', '');
}
if (!isset($config['saml_attr_type'])) {
config_update_value('saml_attr_type', false);
}
if (!isset($config['saml_profiles_and_tags'])) {
config_update_value('saml_profiles_and_tags', '');
}
if (!isset($config['saml_profile'])) {
config_update_value('saml_profile', '');
}
if (!isset($config['saml_tag'])) {
config_update_value('saml_tag', '');
}
if (!isset($config['saml_profile_tag_separator'])) {
config_update_value('saml_profile_tag_separator', '');
}
if (!isset($config['autoupdate'])) {
config_update_value('autoupdate', 1);
}

View File

@ -369,7 +369,7 @@ if (! isset($config['id_user'])) {
if (!$nick_in_db) {
include_once 'general/noaccesssaml.php';
include_once $config['saml_path'].'simplesamlphp/lib/_autoload.php';
$as = new SimpleSAML_Auth_Simple('PandoraFMS');
$as = new SimpleSAML_Auth_Simple($config['saml_source']);
$as->logout();
}
} else {
@ -871,7 +871,7 @@ if (isset($_GET['bye'])) {
if ($config['auth'] == 'saml') {
include_once $config['saml_path'].'simplesamlphp/lib/_autoload.php';
$as = new SimpleSAML_Auth_Simple('PandoraFMS');
$as = new SimpleSAML_Auth_Simple($config['saml_source']);
$as->logout();
}