public function getAuthImpl() { if (!isset(self::$authStorageImpl)) { if (!isset($this->pluginConf["MASTER_INSTANCE_CONFIG"])) { throw new Exception("Please set up at least one MASTER_INSTANCE_CONFIG in core.auth options"); } $masterName = is_array($this->pluginConf["MASTER_INSTANCE_CONFIG"]) ? $this->pluginConf["MASTER_INSTANCE_CONFIG"]["instance_name"] : $this->pluginConf["MASTER_INSTANCE_CONFIG"]; $masterName = str_replace("auth.", "", $masterName); if (!empty($this->pluginConf["SLAVE_INSTANCE_CONFIG"]) && !empty($this->pluginConf["MULTI_MODE"])) { $slaveName = is_array($this->pluginConf["SLAVE_INSTANCE_CONFIG"]) ? $this->pluginConf["SLAVE_INSTANCE_CONFIG"]["instance_name"] : $this->pluginConf["SLAVE_INSTANCE_CONFIG"]; $slaveName = str_replace("auth.", "", $slaveName); // Manually set up a multi config $userBase = $this->pluginConf["MULTI_USER_BASE_DRIVER"]; if ($userBase == "master") { $baseName = $masterName; } else { if ($userBase == "slave") { $baseName = $slaveName; } else { $baseName = ""; } } $mLabel = ""; $sLabel = ""; $separator = ""; $cacheMasters = true; if (isset($this->pluginConf["MULTI_MODE"]) && !isset($this->pluginConf["MULTI_MODE"]["instance_name"])) { $this->pluginConf["MULTI_MODE"]["instance_name"] = $this->pluginConf["MULTI_MODE"]["group_switch_value"]; } if ($this->pluginConf["MULTI_MODE"]["instance_name"] == "USER_CHOICE") { $mLabel = $this->pluginConf["MULTI_MODE"]["MULTI_MASTER_LABEL"]; $sLabel = $this->pluginConf["MULTI_MODE"]["MULTI_SLAVE_LABEL"]; $separator = $this->pluginConf["MULTI_MODE"]["MULTI_USER_ID_SEPARATOR"]; } else { $cacheMasters = $this->pluginConf["MULTI_MODE"]["CACHE_MASTER_USERS_TO_SLAVE"]; } $newOptions = array("instance_name" => "auth.multi", "MODE" => $this->pluginConf["MULTI_MODE"]["instance_name"], "MASTER_DRIVER" => $masterName, "USER_BASE_DRIVER" => $baseName, "USER_ID_SEPARATOR" => $separator, "CACHE_MASTER_USERS_TO_SLAVE" => $cacheMasters, "TRANSMIT_CLEAR_PASS" => $this->pluginConf["TRANSMIT_CLEAR_PASS"], "DRIVERS" => array($masterName => array("NAME" => $masterName, "LABEL" => $mLabel, "OPTIONS" => $this->pluginConf["MASTER_INSTANCE_CONFIG"]), $slaveName => array("NAME" => $slaveName, "LABEL" => $sLabel, "OPTIONS" => $this->pluginConf["SLAVE_INSTANCE_CONFIG"]))); // MERGE BASIC AUTH OPTIONS FROM MASTER $masterMainAuthOptions = array(); $keys = array("TRANSMIT_CLEAR_PASS", "AUTOCREATE_AJXPUSER", "LOGIN_REDIRECT", "AJXP_ADMIN_LOGIN"); if (is_array($this->pluginConf["MASTER_INSTANCE_CONFIG"])) { foreach ($keys as $key) { if (isset($this->pluginConf["MASTER_INSTANCE_CONFIG"][$key])) { $masterMainAuthOptions[$key] = $this->pluginConf["MASTER_INSTANCE_CONFIG"][$key]; } } } $newOptions = array_merge($newOptions, $masterMainAuthOptions); self::$authStorageImpl = ConfService::instanciatePluginFromGlobalParams($newOptions, "AbstractAuthDriver"); AJXP_PluginsService::getInstance()->setPluginUniqueActiveForType("auth", self::$authStorageImpl->getName(), self::$authStorageImpl); } else { self::$authStorageImpl = ConfService::instanciatePluginFromGlobalParams($this->pluginConf["MASTER_INSTANCE_CONFIG"], "AbstractAuthDriver"); AJXP_PluginsService::getInstance()->setPluginUniqueActiveForType("auth", self::$authStorageImpl->getName()); } } return self::$authStorageImpl; }