diff --git a/lib/SimpleSAML/Module.php b/lib/SimpleSAML/Module.php index 0cd8b3dee13481704a490d17d1aeff50b6b784c7..d5dd1b2c5e18eb5fa9a97a786e19c0643bca9ba1 100644 --- a/lib/SimpleSAML/Module.php +++ b/lib/SimpleSAML/Module.php @@ -69,6 +69,16 @@ class Module */ public static $modules = []; + /** + * A list containing the modules that are enabled by default, unless specifically disabled + * + * @var array + */ + public static $core_modules = [ + 'core' => true, + 'saml' => true + ]; + /** * A cache containing specific information for modules, like whether they are enabled or not, or their hooks. * @@ -109,7 +119,7 @@ class Module public static function isModuleEnabled(string $module): bool { $config = Configuration::getOptionalConfig(); - return self::isModuleEnabledWithConf($module, $config->getArray('module.enable', [])); + return self::isModuleEnabledWithConf($module, $config->getArray('module.enable', $this->core_modules)); } @@ -342,8 +352,10 @@ class Module throw new \Exception("Invalid module.enable value for the '$module' module."); } - self::$module_info[$module]['enabled'] = false; - return false; + $core_module = array_key_exists($module, $this->core_modules) ? true : false; + + self::$module_info[$module]['enabled'] = $core_module ? true : false; + return $core_module ? true : false; }