Saml login. Added restiction to admin users and saml button

This commit is contained in:
Arturo Gonzalez 2016-06-03 12:48:04 +02:00
parent 8c30cbd756
commit 9bc9bb9cc3
1 changed files with 14 additions and 8 deletions

View File

@ -288,14 +288,20 @@ if (! isset ($config['id_user'])) {
$nick_in_db = $_SESSION["prepared_login_da"]['id_user']; $nick_in_db = $_SESSION["prepared_login_da"]['id_user'];
$expired_pass = false; $expired_pass = false;
} }
else if (($config['auth'] == 'saml') && $login_button_saml && !is_user_admin($nick)) { else if (($config['auth'] == 'saml') && $login_button_saml) {
include_once(ENTERPRISE_DIR . "/include/auth/saml.php"); if (!is_user_admin($nick)) {
$saml_user_id = saml_process_user_login(); include_once(ENTERPRISE_DIR . "/include/auth/saml.php");
$nick_in_db = $saml_user_id; $saml_user_id = saml_process_user_login();
if (!$nick_in_db) { $nick_in_db = $saml_user_id;
require_once('/opt/simplesamlphp/lib/_autoload.php'); if (!$nick_in_db) {
$as = new SimpleSAML_Auth_Simple('PandoraFMS'); require_once('/opt/simplesamlphp/lib/_autoload.php');
$as->logout(); $as = new SimpleSAML_Auth_Simple('PandoraFMS');
$as->logout();
}
}
else {
$config["auth_error"] = "Error - Cannot log in as admin with 'login with saml' button";
$nick_in_db = false;
} }
} }
else { else {