diff --git a/config-templates/config.php b/config-templates/config.php
index 0e82fb130a6e5eb299489e1cf8a1666cea7d635a..a6812d906da6f8f9304761202f63d2864d54d652 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 be35cbce4dbf828154ddef9f964a34738b97ece7..b1b776217d1b35d096b318557e14a1895a013f2b 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");
 		}