From 0d0ef013cadea7a8ed67b6563b03b0883466c2ec Mon Sep 17 00:00:00 2001 From: nod3zer0 <game1men@gmail.com> Date: Fri, 6 Sep 2024 16:47:11 +0200 Subject: [PATCH] Updated SimpleSamlPHP to work without composer - added configiguration that allows user to configure path to SimpleSamlPHP library --- config/config_defaults.inc.php | 1 + lib/classes/auth_plugins/StudipAuthSimpleSamlPHP.php | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/config/config_defaults.inc.php b/config/config_defaults.inc.php index d22e57f885c..16e33a9b30e 100644 --- a/config/config_defaults.inc.php +++ b/config/config_defaults.inc.php @@ -328,6 +328,7 @@ $STUDIP_AUTH_CONFIG_OAUTH2 = [ $STUDIP_AUTH_CONFIG_SIMPLESAMLPHP = [ 'sp_name' => 'default-sp', + 'path_to_simple_saml_php' => '/var/simplesamlphp/src/_autoload.php' // path to _autoload.php of SimpleSamlPHP library 'user_data_mapping' => [ 'auth_user_md5.Email' => ['callback' => 'getUserData', 'map_args' => 'email'], 'auth_user_md5.Nachname' => ['callback' => 'getUserData', 'map_args' => 'firstName'], diff --git a/lib/classes/auth_plugins/StudipAuthSimpleSamlPHP.php b/lib/classes/auth_plugins/StudipAuthSimpleSamlPHP.php index 69745a82024..18b7e36ff96 100644 --- a/lib/classes/auth_plugins/StudipAuthSimpleSamlPHP.php +++ b/lib/classes/auth_plugins/StudipAuthSimpleSamlPHP.php @@ -16,6 +16,8 @@ class StudipAuthSimpleSamlPHP extends StudipAuthSSO // Name of attribute that contains username (if empty it will use NameID as username) public ?string $username_attribute = null; + public ?string $path_to_simple_saml_php = null; + public ?array $userdata = null; public SimpleSAML\Auth\Simple $as; @@ -26,6 +28,12 @@ class StudipAuthSimpleSamlPHP extends StudipAuthSSO { parent::__construct($config); + if(!isset($this->path_to_simple_saml_php)){ + require_once('/var/simplesamlphp/src/_autoload.php'); + }else{ + require_once($this->path_to_simple_saml_php ); + } + if (!isset($this->plugin_fullname)) { $this->plugin_fullname = _('SAML'); } -- GitLab