/** * Check whether the current user backend is valid, i.e. it's enabled, not an external user backend and whether its * config is valid * * @return bool */ public function valid() { if (!$this->config->valid()) { // Stop when there are no more backends to check return false; } $backendConfig = $this->config->current(); if ((bool) $backendConfig->get('disabled', false)) { $this->next(); return $this->valid(); } $name = $this->key(); try { $backend = UserBackend::create($name, $backendConfig); } catch (ConfigurationError $e) { Logger::error(new ConfigurationError('Can\'t create authentication backend "%s". An exception was thrown:', $name, $e)); $this->next(); return $this->valid(); } if ($this->getSkipExternalBackends() && $backend instanceof ExternalBackend) { $this->next(); return $this->valid(); } $this->currentBackend = $backend; return true; }