diff options
-rw-r--r-- | config-templates/config.php | 20 | ||||
-rw-r--r-- | lib/SimpleSAML/Module.php | 11 |
2 files changed, 31 insertions, 0 deletions
diff --git a/config-templates/config.php b/config-templates/config.php index 0e82fb1..a6812d9 100644 --- a/config-templates/config.php +++ b/config-templates/config.php @@ -177,6 +177,26 @@ $config = array ( 'enable.wsfed-sp' => false, 'enable.authmemcookie' => false, + + /* + * Module enable configuration + * + * Configuration to override module enabling/disabling. + * + * Example: + * + * 'module.enable' => array( + * // Setting to TRUE enables. + * 'exampleauth' => TRUE, + * // Setting to FALSE disables. + * 'saml' => FALSE, + * // Unset or NULL uses default. + * 'core' => NULL, + * ), + * + */ + + /* * This value is the duration of the session in seconds. Make sure that the time duration of * cookies both at the SP and the IdP exceeds this duration. diff --git a/lib/SimpleSAML/Module.php b/lib/SimpleSAML/Module.php index be35cbc..b1b7762 100644 --- a/lib/SimpleSAML/Module.php +++ b/lib/SimpleSAML/Module.php @@ -42,6 +42,17 @@ class SimpleSAML_Module { return FALSE; } + $globalConfig = SimpleSAML_Configuration::getInstance(); + $moduleEnable = $globalConfig->getArray('module.enable', array()); + + if(isset($moduleEnable[$module])) { + if(is_bool($moduleEnable[$module]) === TRUE) { + return $moduleEnable[$module]; + } + + throw new Exception("Invalid module.enable value for for the module $module"); + } + if (assert_options(ASSERT_ACTIVE) && !file_exists($moduleDir . '/default-enable') && !file_exists($moduleDir . '/default-disable')) { SimpleSAML_Logger::error("Missing default-enable or default-disable file for the module $module"); } |